Date object explained clearly
This commit is contained in:
parent
b85413d0bd
commit
44bc57ee91
1 changed files with 13 additions and 2 deletions
|
@ -2,7 +2,18 @@ The `new Date` constructor uses the local time zone. So the only important thing
|
||||||
|
|
||||||
So February has number 1.
|
So February has number 1.
|
||||||
|
|
||||||
|
Date object can be created in two formats:
|
||||||
|
|
||||||
|
1. new Date(year, month, date, hour, minute, second, millisecond)
|
||||||
|
|
||||||
```js run
|
```js run
|
||||||
let d = new Date(2012, 1, 20, 3, 12);
|
let d1 = new Date(2012, 1, 20, 3, 12);
|
||||||
alert( d );
|
alert( d1 );
|
||||||
|
```
|
||||||
|
|
||||||
|
2. new Date(datastring)
|
||||||
|
|
||||||
|
```js run
|
||||||
|
let d2 = new Date("February 20, 2012 03:12:00");
|
||||||
|
alert(d2);
|
||||||
```
|
```
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue