VIDEO 13 javascript
Sun Oct 27 2024 16:57:41 GMT+0000 (Coordinated Universal Time)
Saved by
@E23CSEU1151
//////////************ DATE AND TIME ****************///////////////
let myDate = new Date()
console.log(myDate);///2024-10-27T15:14:36.998Z
console.log(myDate.toString());///Sun Oct 27 2024 15:14:36 GMT+0000 (Coordinated Universal Time)
console.log(myDate.toDateString());////Sun Oct 27 2024
console.log(myDate.toISOString());////2024-10-27T15:14:36.998Z
console.log(myDate.toLocaleString());///10/27/2024, 3:14:36 PM
console.log(myDate.toLocaleTimeString());////3:14:36 PM
console.log(typeof myDate); /// object
console.log( " new date " );
let myCreatedDate = new Date(2023 , 0, 23) //// in js months starts from 0 means 0=january
console.log(myCreatedDate.toDateString()); ////Mon Jan 23 2023
let myCreatedDate2 = new Date(2023-01-23) //// in ddmmyy 1 = january in months
console.log(myCreatedDate2.toDateString());
let myCreatedDate3 = new Date(01-41-2023) //// in mmddyy 1 = january in months
console.log(myCreatedDate3.toDateString());
let myTimeStamp = Date.now()
console.log(myTimeStamp);
console.log(myCreatedDate.getTime()); /// at time i started
console.log(Math.floor(Date.now()/1000));// converting in seconds and floor for gettting a acute time
let newDate = new Date();
console.log(newDate.getMonth()+1);
console.log(newDate.getDay());
newDate.toLocaleString('default',{ //// for setting something as default setting
weekday: "long"
timeZone: ' '
})
content_copyCOPY
Comments