CONVERT DATES TO STRINGS
If you want to create a custom format for displaying a date string, the
easiest way to do so is to create a new Date object and get the individual
pieces to put a string together, as in the previous examples. JavaScript also
includes methods to create a string in a standard format, such as
toString(), which returns the date as a string, for example:
var myTime = new Date (); var newTime = myTime.toString(); document.write (newTime);
This displays the current date and time as a string, such as:
Sun Sep 14 03:06:30 MDT 2003
Another method is toUTCString(), which returns the date as a UTC
string. If you change the above string to:
var newTime = myTime.toUTCString();
This displays the current date and time as a UTC string, such as:
Sun, 14 Sep 2003 09:06:30 UTC
