diff --git a/files/en-us/web/javascript/reference/global_objects/date/index.md b/files/en-us/web/javascript/reference/global_objects/date/index.md index e9355f4db13b25d..e4ac4cc19faa2ea 100644 --- a/files/en-us/web/javascript/reference/global_objects/date/index.md +++ b/files/en-us/web/javascript/reference/global_objects/date/index.md @@ -325,17 +325,19 @@ date.toLocaleTimeString(); // 6:50:21 PM ### To get Date, Month and Year or Time ```js -const date = new Date(); +const date = new Date("2000-01-17T16:45:30"); const [month, day, year] = [ date.getMonth(), date.getDate(), date.getFullYear(), ]; +// [0, 17, 2000] as month are 0-indexed const [hour, minutes, seconds] = [ date.getHours(), date.getMinutes(), date.getSeconds(), ]; +// [16, 45, 30] ``` ### Interpretation of two-digit years