Extra-JS
Date instance
//To create a new Date() instance we
let data= new Date( 2002, 02, 20, 10, 50, 22 )
//new Date(year,month,day,hours,minutes,seconds,ms)
Wed Mar 20 2002 10:50:22 GMT+0100 (Ora standard dell’Europa centrale)
//we can also use the ISO 8601 format as a STRING with specific syntax
let iso= new Date( "1995-12-17T03:24:00" ) YYYY-MM-DDTHH:mm:ss.sssZ
Sun Dec 17 1995 03:24:00 GMT+0100 (Ora standard dell’Europa centrale)
//toString() is a string parsing like new Date()
let white= new Date() //Sat Feb 04 2023 12:38:00 GMT+0100 / OBJECT
white.toString() //Sat Feb 04 2023 12:38:00 GMT+0100 / STRING//We can get different date strings based on the timeZones
white.toLocaleString() //13/1/2023, 13:54:00
white.toLocaleString("en-US") //1/13/2023, 1:53:44 PM
//we can also get DATE and TIME
white.toDateString() //Fri Jan 13 2023
white.toLocaleDateString("en-US") //1/13/2023
white.toTimeString() //14:19:43 GMT+0100 (Ora standard dell’Europa centrale)
white.toLocaleTimeString("en-US") //2:19:43 PM
//on Date the en-GB shows 13/01/2023Last updated