Export (0) Print
Expand All

toTimeString Method (Date) (JavaScript)

Returns a time as a string value.

objDate. toTimeString( )

The required objDate reference is a Date object.

The toTimeString method returns a string value containing the time in the current time zone.

In the following example, the time is set to 2000 milliseconds after midnight January 1, 1970 UTC, and then it is written out.

var aDate = new Date();
     aDate.setTime(2000);
     document.write(aDate.toTimeString());

// Output depends on the time in the current time zone.

Supported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards, Internet Explorer 10 standards, Internet Explorer 11 standards. Also supported Store apps (Windows 8 and Windows Phone 8.1). See Version Information.

Show:
© 2014 Microsoft