difference between moment js functions and javascript date functions

Moment.js is convenient when you want to manipulate Dates.

An Example for moment is given below

moment()
  .add(7, 'days')
  .subtract(1, 'months')
  .year(2009)
  .hours(0)
  .minutes(0)
  .seconds(0);

moment().endOf('day').fromNow();  

But if formatting, getting and setting is all you need, you might not need a library for that.


Moment.js

A lightweight JavaScript date library for parsing, validating, manipulating, and formatting dates.

Reason why we use Moment.js - Many web applications today, especially social ones, deal with the concept of time. They are usually employed to sort events or posts, or to mark the moment in which something happens. You can think of your Twitter timeline or your GitHub news feed. JavaScript has a Date object that you can use to manipulate dates, but it often doesn’t have all you need in your web applications

The Moment.js library not only parses dates from strings, but it may also be used to validate, manipulate, and format dates. It supports internationalization, which is so important with dates, as well as human-friendly formatting like "Last Friday at 9:48".

These are all good things for sure, but today's order of the day is date parsing, so let's get into how that works.

Moment.js creates a wrapper for the Date object rather than extend it. To reference the wrapper object, simply call the moment() getter function. The Moment prototype is exposed through the moment.fn property, so you can add your own functions to it if you are so inclined.

Courtesy of

Managing Dates and Times Using Moment.js

A Roundup of Popular JavaScript Date Parsing Libraries: Moment.js


Obviously, I would suggest to go with moment.js. It is one of the most popular Date parsing library.

moment.js has a various inbuilt function's available which is easy to use.

It will save your development time.

Manipulating and parsing dates is very easy.