---
hide_title: false
hide_table_of_contents: false
pagination_next: null
pagination_prev: null
---
# Date.prototype.valueOf()

The **`valueOf()`** method returns the primitive value of a
`Date` object.



## Syntax

```js
valueOf()
```

### Return value

The number of milliseconds between 1 January 1970 00:00:00 UTC and the given date, or [`NaN`](../../NaN.mdx) in case of an invalid date.

## Description

The `valueOf()` method returns the primitive value of a `Date`
object as a number data type, the number of milliseconds since midnight 01 January, 1970
UTC.

This method is functionally equivalent to the [`Date.prototype.getTime()`](./getTime.mdx)
method.

This method is usually called internally by JavaScript and not explicitly in code.
