Moment.js Parsing Date Last Updated : 18 Jun, 2022 Summarize Comments Improve Suggest changes Share Like Article Like Report Moment.js is a date library for JavaScript that parses, validates, manipulates, and formats dates. We can use the moment() function passed with an object to parse dates represented as Date object. The moment() function is used to create a moment using a Date object. Syntax: moment( Date ) Parameters: It takes a Date object representing the specified date. Return Value: It returns a Moment object. Example 1: JavaScript import moment from 'moment'; let day = new Date(2001, 1, 21); let date = moment(day); console.log(date.format("dddd, Do MMM YYYY, h:mm:ss A")); Output: Example 2: JavaScript import moment from 'moment'; let day = Date.now(); let date = moment(day); console.log(date.format("DD/MM/YYYY-H:mm:ss")); Output: Reference: https://momentjs.com/docs/#/parsing/date/ Comment More infoAdvertise with us Next Article Moment.js Parsing Date A aayushmohansinha Follow Improve Article Tags : Web Technologies Node.js Moment.js Moment.js-Parse Similar Reads Moment.js Parsing Defaults Moment.js is a date library for JavaScript that parses, validates, manipulates, and formats dates. We can use the moment() function by providing only a few parameters and the rest will default to the current day, month, or year and 0 for an hour, minute, second, and millisecond. The moment() functio 1 min read Moment.js Parsing Array Moment.js is a date library for JavaScript that parses, validates, manipulates, and formats dates. We can pass an array to the moment() function to parse a date represented in the form of an array. The moment() function is used to create a moment using an array. Syntax: moment(Number[]) Parameters: 1 min read Moment.js Parsing Now Moment.js is a date library for JavaScript that parses, validates, manipulates, and formats dates. We can use the moment() function passed to get the current date and time. The moment() function is used to create a moment with the current date and time. Syntax: moment() | moment(undefined) | moment( 1 min read Moment.js Parsing Creation Data Moment.js is a date library for JavaScript that parses, validates, manipulates, and formats dates. We can use the creationData() method to get information about the input, format etc of a given moment. The moment().creationData() function can be used to retrieve the creation data of a given specific 4 min read Moment.js Parsing UTC Moment.js is a JavaScript date library for parsing, validating, manipulating, and formatting dates. UTC stands for Universal Time Coordinated which is maintained by the Bureau International des Poids et Measures (BIPM). Moment.js uses the moment() function by default to parse and display in local ti 2 min read Like