MomentJS - As Object


Advertisements

This method gives the output in object form containing year, month, day-of-month, hour, minute, seconds, milliseconds.

Syntax

moment().toObject();

Example

var a = moment().toObject();
var objstr = a.years + " " + a.months + " " + a.date + " " + a.hours + " " + a.minutes + " " + a.seconds;

Output

As Object
momentjs_formatting_date_and_time.htm
Advertisements