- 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 - Parsing Date and Time
MomentJS has many easy to use methods which helps in parsing Date and Time. It can parse dates in the form of object, string, array, JavaScript native date object etc. This chapter discusses them in detail.
Parsing Date
MomentJS gives wrapper object as output when moment() is called. You can observe the following when you console the output in the browser.
MomentJS provides various methods to parse the Date as listed below −
Sr.No. | Method & Syntax |
---|---|
1 | Now
moment() |
2 | String
moment(string) |
3 | Object
moment(object) |
4 | Date
moment(Date) |
5 | Array
moment(Array[]) |
6 | Unix Timestamp
moment(number) |
7 | Moment Clone
moment(Moment) |
8 | UTC
moment.utc() |
9 | parseZone
moment.parseZone() |
10 | Creation Data
moment().creationData(); |
11 | Defaults
var m = moment({hour: 3, minute: 40, seconds: 10}); |
Advertisements