MomentJS - As ISO 8601 String



This method formats a string to the ISO8601 standard. It gives the timestamp in UTC form.

Syntax

moment().toISOString();
moment().toISOString(keepOffset);

Example

var a = moment().toISOString();

Output

As ISO

To avoid the display in UTC form use true in toISOString(true) as shown

Example

var a = moment().toISOString(true);

Output

toISOString
momentjs_formatting_date_and_time.htm
Advertisements