Update solution.md
This commit is contained in:
parent
243a1d3276
commit
37287af523
1 changed files with 4 additions and 5 deletions
|
@ -2,18 +2,17 @@ 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:
|
Here's an example with numbers as date components:
|
||||||
|
|
||||||
1. new Date(year, month, date, hour, minute, second, millisecond)
|
|
||||||
|
|
||||||
```js run
|
```js run
|
||||||
|
//new Date(year, month, date, hour, minute, second, millisecond)
|
||||||
let d1 = new Date(2012, 1, 20, 3, 12);
|
let d1 = new Date(2012, 1, 20, 3, 12);
|
||||||
alert( d1 );
|
alert( d1 );
|
||||||
```
|
```
|
||||||
|
We could also create a date from a string, like this:
|
||||||
2. new Date(datastring)
|
|
||||||
|
|
||||||
```js run
|
```js run
|
||||||
|
//new Date(datastring)
|
||||||
let d2 = new Date("February 20, 2012 03:12:00");
|
let d2 = new Date("February 20, 2012 03:12:00");
|
||||||
alert( d2 );
|
alert( d2 );
|
||||||
```
|
```
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue