- MomentJS Tutorial
- MomentJS - Home
- MomentJS - Overview
- MomentJS - Environment Setup
- MomentJS - Introduction
- MomentJS - Parsing Date And Time
- MomentJS - Date Validation
- MomentJS - Getter/Setter
- Manipulate Date And Time
- Formatting Date And Time
- MomentJS - Date Queries
- MomentJS - Internationalization
- MomentJS - Customization
- MomentJS - Durations
- MomentJS - Utilities
- MomentJS - Plugins
- MomentJS - Examples
- MomentJS Useful Resources
- MomentJS - Quick Guide
- MomentJS - Useful Resources
- MomentJS - Discussion
MomentJS - Hour
This method will get/set the hour. It takes input from 0-23, if greater than the range provided, it will add to the day.
Syntax
moment().hour(Number); moment().hour(); moment().hours(Number); moment().hours();
Example
var m = moment().hour(); // gets the current hour var d = moment().hour(8); // sets the hour as shown below
Output
momentjs_getter_setter.htm
Advertisements
To Continue Learning Please Login
Login with Google