![]() |
VOOZH | about |
The date.toTimeString() method is used to return the time portion of the given date object in English. The date object is created using date() constructor.
dateObj.toTimeString()This function does not accept any parameter. It is just used along with a Date object created using the Date() constructor whose time portion contents are returned in English-like language.
It returns the time portion of the given date object in English.
Note: The DateObj is a valid Date object created using the Date() constructor whose time portion contents are returned.
Example 1: This example shows the use of Date toTimeString() Method.
Output:
05:35:32 GMT+0530 (India Standard Time)Example 2: Here nothing as a parameter is passed while creating the date object but still toTimeString() method returns the current time.
Output:
14:58:08 GMT+0530 (India Standard Time)Example 3: When the time part is not given to the parameter of the Date() constructor then it returns the time as zeros(0).
Output:
00:00:00 GMT+0530 (India Standard Time)We have a complete list of Javascript Date Objects, to check those please go through this article.