Javatpoint Logo
Javatpoint Logo

JavaScript Date toTimeString() method

The JavaScript date toTimeString() method returns the time portion of a Date object in the form of string.

Syntax

The toTimeString() method is represented by the following syntax:

Return

A string representing the time portion of a Date object.

JavaScript Date toTimeString() method example

Here, we will understand toTimeString() method through various examples.

Example 1

Let's see an example to fetch current time in the form of string.

Test it Now

Output:

10:19:29 GMT+0530 (India Standard Time) 

Example 2

Let's see an example to fetch time portion only from the specified Date object.

Test it Now

Output:

20:22:10 GMT+0530 (India Standard Time) 

Example 3

Let's see one more example to fetch time portion only from the specified Date object.

Test it Now

Output:

20:22:10 GMT+0530 (India Standard Time)
Next TopicJavaScript Date




Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA