Javatpoint Logo
Javatpoint Logo

JavaScript Date valueOf() method

The JavaScript date valueOf() method returns the primitive value of a Date object.

Syntax

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

Return

A primitive value of a Date object.

JavaScript Date valueOf() method example

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

Example 1

Let's see an example to fetch primitive value of a Date object.

Test it Now

Output:

1533815687148 

Example 2

Let's see an example to fetch primitive value of the specified Date object.

Test it Now

Output:

-706266470000

Example 3

Let's see one more example to fetch the primitive value of the specified Date object.

Test it Now

Output:

1534344730000
Next TopicJavaScript Date




Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


B.Tech / MCA