|
In this article we will explore the Date features in ECMAScript5. We will look into the implementation of Date.Now, Date.toJSON and Date.toISOString.
Date.Now
Date.Now returns current time since midnight GMT on January1, 1970 in milliseconds.Date.Now of ECMAScript5 is equivalent to (new Date()).getTime() which is used in prior to ECMAScript5.
Date.toJSON
Date.toJSON serializes date object. It returns JSON formatted string of Date object.
var jsonDate = (new Date()).toJSON();
Date.toISOString
Date.toISOString converts date into ISO8601-formatted string. The returned string ISO-8601 standard formatted. The format of returned string is
yyyy-mm-ddThh:mm:ss.sssZ
This ends the article of Date features in ECMAScript 5.
|