From 44bc57ee91d2b662e5968546eebebe6a5f97e1a8 Mon Sep 17 00:00:00 2001 From: AasthaSinha2305 <55781193+AasthaSinha2305@users.noreply.github.com> Date: Sun, 23 Aug 2020 18:01:21 +0530 Subject: [PATCH] Date object explained clearly --- 1-js/05-data-types/11-date/1-new-date/solution.md | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/1-js/05-data-types/11-date/1-new-date/solution.md b/1-js/05-data-types/11-date/1-new-date/solution.md index 9bb1d749..c1047158 100644 --- a/1-js/05-data-types/11-date/1-new-date/solution.md +++ b/1-js/05-data-types/11-date/1-new-date/solution.md @@ -2,7 +2,18 @@ The `new Date` constructor uses the local time zone. So the only important thing 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 -let d = new Date(2012, 1, 20, 3, 12); -alert( d ); +let d1 = new Date(2012, 1, 20, 3, 12); +alert( d1 ); +``` + +2. new Date(datastring) + +```js run +let d2 = new Date("February 20, 2012 03:12:00"); +alert(d2); ```