Temporal is an modern new API for Date related objects.

It introduced following classes in new API

  • Plain Time classes: These classes helps to get plain time related without timezone
    • PlainDateTime
    • PlainDate
    • PlainTime
  • ZonedDateTime class provides methods to get timezone and calendar

Current Javascript version contains Date object to get full year.

let currentDate = new Date();
let year = currentDate.getFullYear();

With temporal,

  • you can get PlainDate object
  • this object contains year property
 now = Temporal.now.plainDate();
 let year = now.year;

Some of the Examples

To Get Current Date and time in ISO format


to get plain TIme in ISO format