The JavaScript date toTimeString() method is used to get the time portion of a Date object.
Syntax:
dateObj.toTimeString();
Return:
String representation of time portion of a Date object.
Example:
<!DOCTYPE html> <html> <body> <script> var bday=new Date("November 16, 1994 21:10:10"); document.writeln(bday.toTimeString()); </script> </body> </html> |
Output:
21:10:10 GMT+0530 (IST) |