Hello Friends đź‘‹,

Welcome To Infinitbility! ❤️

To get the current date in typescript has the Date() object it will return every time the current date and time when we use it.

we have to just write new Date() and it returns the date object where we get a year, month, date, hours, minutes, and seconds.

let today: object = new Date();
console.log(today); // 2022-02-06T08:05:49.292Z

Now, we know we have the current date but when we want to convert the date in UTC or want to get the UTC date-time we have also followed some other steps.

To get UTC date and time typescript have new Date().toISOString() it will return currnt UTC date time string.

Hear, ISO full form is International Organization for Standardization.

let today: string = new Date().toISOString();
console.log(today) // 2022-02-07T11:42:04.426Z'

Thanks for reading…