valueOf()
JavaScript Date valueOf() method
Last Updated : 17 Mar 2025
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.
Output:
Example 2
Let's see an example to fetch primitive value of the specified Date object.
Output:
Example 3
Let's see one more example to fetch the primitive value of the specified Date object.
Output: