This commit is contained in:
Ilya Kantor 2019-11-06 20:28:04 +03:00
parent 2aedc2df49
commit ecd93e97b3
2 changed files with 10 additions and 3 deletions

View file

@ -33,6 +33,13 @@ To create a new `Date` object call `new Date()` with one of the following argume
It's a lightweight numeric representation of a date. We can always create a date from a timestamp using `new Date(timestamp)` and convert the existing `Date` object to a timestamp using the `date.getTime()` method (see below).
Dates before 01.01.1970 have negative timestamps, e.g.:
```js run
// 31 Dec 1969
let Dec31_1969 = new Date(-24 * 3600 * 1000);
alert( Dec31_1969 );
```
`new Date(datestring)`
: If there is a single argument, and it's a string, then it is parsed automatically. The algorithm is the same as `Date.parse` uses, we'll cover it later.