Date
class is used to create the time and date.
- Syntax:
const today = new Date(); // creates today date and time const dateFromTimestamp = new Date(1677733088145); // creates date and time by timestamp
getFullYear()
- returns the yeargetMonth()
- returns the index of monthgetDay()
- returns the index of daygetDate()
- returns the dategetTime()
- returns the timestampgetHours()
- returns the hoursgetMinutes()
- returns the minutesgetSeconds()
- returns the secondstoDateString()
- returns the date stringtoTimeString()
- returns the time string