Hello All,

Today, I am going to representing front of  you how to work with Moment.js library in Node.js.

What is Moment.js ?

Moment.js is a Javascript library for parsing, validating, manipulating, formatting and displaying dates and times.

Why use Moment.js ?

It gets hard to handle date and time while developing web applications. As a developer, getting date from server then converting, comparing and displaying date and time might get tricky in Node.js.

Where to use Moment.js ?

Moment was designed to work both in the browser and in Node.js.

How to install Moment.js ?

How to use Moment.js in Node.js?

Features provided by Moment.js

1. Traditional way to create a  new date and Parse it with Moment.js.

2. Format date with Moment.js.

3. Converting string to date.

Moment.js provide a simple way to convert string to date.

4. Convert date to string.

Moment.js provide a simple way to convert date to string.

5. Date validation.

Moment.js have predefined  method to validate date. You can check whether the Moment considers the date invalid using moment().isValid.

6. Add day,month and year

With the help of Moment.js library we can easily add day, month and year in date.

7. Subtract day,month and year.

With the help of Moment.js library we can easily subtract date by day, month and year.

8. Difference between two dates

I hope you get help full information from my blog.

reference: https://momentjs.com/

Please comments and share your experience with me to make us better next time.