Navigate back to the homepage

How to get current UTC date in typescript?

February 8th, 2022 · 1 min read
keep affilitate

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.

1let today: object = new Date();
2console.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.

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

Thanks for reading…

Follow me on Twitter

Join our email list and get notified about new content

No worries, I respect your privacy and I will never abuse your email.

Every week, on Tuesday, you will receive a list of free tutorials I made during the week (I write one every day) and news on other training products I create.

melio affilitate

Looking For React Native Tutorial?

we are trying to create the best Tutorial for react native developers.

When you want a daily updates about React Native Tutorial or infinitbility update subscribe to our newsletter.

Read React Native Tutorial

Request New Tutorial or Article on mail [email protected]

Guide book

Guidebook: The Javascript Monorepo Photoshop Guide



More articles from Infinitbility

How to get current month in typescript?

TypeScript, get current month example.

February 7th, 2022 · 1 min read

How to get current year in typescript?

TypeScript, get current year example.

February 7th, 2022 · 1 min read
© 2020–2022 Infinitbility
Link to $ to $ to $ to $ to $ to $mailto:[email protected]