Moment.js Parsing Object Last Updated : 18 Jun, 2022 Comments Improve Suggest changes 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 objects. The moment() function is used to create a moment using an object. Syntax: moment({unit: value, ...}) Parameters: It takes an object representing a specific date. The fields in the object should be used to describe the specifics of the date like year, month, day, hour, minutes, seconds, and milliseconds. Return Value: It returns a Moment object. Example 1: JavaScript import moment from 'moment'; let obj = { year: 2022, hour: 12, minute: 55 }; let date = moment(obj); console.log(date.format("DD/MM/YYYY-H:mm:ss")); Output: Example 2: JavaScript import moment from 'moment'; let obj = { year: 1999, month: 4, day: 21, minutes: 10, second: 7, milliseconds: 55 }; let date = moment(obj); console.log(date.format("dddd, Do MMM YYYY, h:mm:ss A")); Output: Reference: https://momentjs.com/docs/#/parsing/object/ Create Quiz Comment A aayushmohansinha Follow 0 Improve A aayushmohansinha Follow 0 Improve Article Tags : Web Technologies Node.js Moment.js Moment.js-Parse Explore Introduction & Installation NodeJS Introduction3 min readNode.js Roadmap: A Complete Guide6 min readHow to Install Node.js on Linux6 min readHow to Install Node.js on Windows5 min readHow to Install NodeJS on MacOS6 min readNode.js vs Browser - Top Differences That Every Developer Should Know6 min readNodeJS REPL (READ, EVAL, PRINT, LOOP)4 min readExplain V8 engine in Node.js7 min readNode.js Web Application Architecture3 min readNodeJS Event Loop5 min readNode.js Modules , Buffer & StreamsNodeJS Modules5 min readWhat are Buffers in Node.js ?4 min readNode.js Streams4 min readNode.js Asynchronous ProgrammingAsync Await in Node.js3 min readPromises in NodeJS7 min readHow to Handle Errors in Node.js ?4 min readException Handling in Node.js3 min readNode.js NPMNodeJS NPM6 min readSteps to Create and Publish NPM packages7 min readIntroduction to NPM scripts2 min readNode.js package.json4 min readWhat is package-lock.json ?3 min readNode.js Deployments & CommunicationNode Debugging2 min readHow to Perform Testing in Node.js ?2 min readUnit Testing of Node.js Application5 min readNODE_ENV Variables and How to Use Them ?2 min readDifference Between Development and Production in Node.js3 min readBest Security Practices in Node.js4 min readDeploying Node.js Applications5 min readHow to Build a Microservices Architecture with NodeJS3 min readNode.js with WebAssembly3 min readResources & ToolsNode.js Web Server6 min readNode Exercises, Practice Questions and Solutions4 min readNode.js Projects9 min readNodeJS Interview Questions and Answers15+ min read Like