Skip to content

Commit 44bc57e

Browse files
Date object explained clearly
1 parent b85413d commit 44bc57e

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

1-js/05-data-types/11-date/1-new-date/solution.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,18 @@ The `new Date` constructor uses the local time zone. So the only important thing
22

33
So February has number 1.
44

5+
Date object can be created in two formats:
6+
7+
1. new Date(year, month, date, hour, minute, second, millisecond)
8+
9+
```js run
10+
let d1 = new Date(2012, 1, 20, 3, 12);
11+
alert( d1 );
12+
```
13+
14+
2. new Date(datastring)
15+
516
```js run
6-
let d = new Date(2012, 1, 20, 3, 12);
7-
alert( d );
17+
let d2 = new Date("February 20, 2012 03:12:00");
18+
alert(d2);
819
```

0 commit comments

Comments
 (0)