- 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 - Defaults
When we create moment, it gives the output as the current day, month, year, hour, minutes and seconds. We can specify the units to be default one while creating moment and the same will be displayed keeping rest same as per the current date/time.
Example
var m = moment({hour: 3, minute: 40, seconds: 10});
Note that in the above example we have defaulted the hour, minute and seconds to 03:40:10 and the same is displayed keeping rest the current date.
Output
momentjs_parsing_date_and_time.htm
Advertisements