Whatβs the date today?
You can tell the date physically if you have a calendar around you. You can also tell the time if you have a clock. In JavaScript, we can tell the date and time with the Date object.
Hereβs what it looks like:
const date = new Date()If you console.log date, youβll get a log that tells you four things:
- The day of the week (like Wednesday)
- The date today (like Jan 23 2019)
- The time now (like 17:21:13)
- The timezone offset (like GMT+8000 Singapore Standard Time)
Wed Jan 23 2019 17:21:13 GMT+0800 (Singapore Standard Time)Thereβs more things you can do with the Date object. Letβs go through them all in the next few lessons.
Welcome! Unfortunately, you donβt have access to this lesson. To get access, please purchase the course or enroll in Magical Dev School.
Unlock this lesson