Browser Support So I wonder: What is the idiomatic way of representing dates and times in JavaScript code that uses Moment.js? Syntax dateObj.toISOString() Return value. Let’s meet a new built-in object: Date. In any of these cases, the resulting date is relative to the timezone of your computer. Which means it cannot parse a time string HH:mm:ss without a date, but it can parse a date string. Engines which have not been updated to support this method can work around the absence of this method using the following shim: In JavaScript, a time stamp is the number of milliseconds that have passed since January 1, 1970. JavaScript, without any information about the timezone, will consider the date as UTC, and will automatically perform a conversion to the current computer timezone. This method was standardized in ECMA-262 5th edition. So storing a time of day as something like moment('0001-01-01T09:30+00:00') again seems rather hackish to me. JavaScript Tutorial: JavaScript Dates. Parsing a Date. The toUTCString() method converts a date to a string, using the UTC time zone. Converting a string to a JavaScript date … A string representing the given date in the ISO 8601 format according to universal time.. Polyfill. For instance, we can use it to store creation/modification times, to measure time, or just to print out the current date. Syntax: usaTime = date.toLocaleString("en-US", {timeZone… JavaScript Tutorial: JavaScript Strings This means that two different computers might output a different value for the same date object. Syntax: dateObj.toString() Parameters: This method does not accept any parameter. JavaScript Tutorial: JavaScript Date Formats. The format() method of this object is used to return a string of the date with the specified locale and formatting options. Output: Tue Oct 15 1996 05:35:32 GMT+0530 (India Standard Time) The date.toString() method is used to convert the given date object’s contents into a string.The date object is created using date() constructor. This will format the date to the timezone required and return a string with the converted date. To create a new Date object call new Date() with one of the following arguments: new Date() We can test this in the browser by creating a new variable and assigning to it a new Date instance based on a timestamp of 0 . Creation. Using Date() If you don’t intend to support