date and time object
console.log("working");
let date=new Date()
console.log(date)
/* output: Thu Apr 22 2021 18:28:07 GMT+0545 (Nepal Time)*/
/*to get each of the day and month*/
let day=date.getDay()
console.log(day)
//output: 4 basically: sun=0,mon=1 and so on
let month=date.getMonth()
console.log(month)
//output: 3
let year=date.getFullYear()
console.log(year)
//output:1-20<-------this back 20 is yerar i.e 2020
let minutes=date.getMinutes()
console.log(minutes)
/*to set your own date and time*/
date.setDate(20)
console.log(date)
// this will set your gateeee in nepali (date)
ans so on
setMinutes()
setHours()
setSeconds()
setFullYear()
or setYear()
Comments
Post a Comment