toLocaleString()

The toLocaleString() method is used to return the date in a standardized format, the date for which being taken from the date specified by your operating system, and used by the Date object. The value returned is in the following format:

Day, Month DD, YYYY HH:MM:SS AM or PM

UTC stands for Universal Time Coordinate and is the value, in milliseconds, from the date of January 1st, 1970. This value is then computed to take the form the method being stated calls for. This method returns the exact same results as does the toGMTString() method. It is recommended you use the toGMTString() method instead.

syntax:

dateName.toLocaleString()

EXAMPLE

dateObject = new Date();

document.write("The date is: " + dateObject.toLocaleString());

The example shows the creation of a new Date object, called dateObject. It is then used within a document.write statement, with the toLocalString() method to display its value, in this case the full date and time, after the string of text..