Navigate back to the homepage

How to convert date to iso format in typescript?

May 1st, 2022 · 1 min read
keep affilitate

Hi Friends 👋,

Welcome to Infinitbility ❤️!

This tutorial will help you to convert date to iso format in typescript, here we will use the toISOString() method to convert date to iso format.

what is toISOString()?

The toISOString() method returns a string in simplified extended ISO format (ISO 8601), which is always 24 or 27 characters long (YYYY-MM-DDTHH:mm:ss.sssZ or ±YYYYYY-MM-DDTHH:mm:ss.sssZ, respectively). The timezone is always zero UTC offset, as denoted by the suffix “Z”.


Let’s start today’s tutorial How to convert date to iso format in typescript?

Before diving into code, let’s see what we are going to do.

  1. Create a date and store it in a variable.
  2. use toISOString() method
  3. check converted date output
1const date = new Date('05 October 2011 14:48 UTC');
3// expected output: 2011-10-05T14:48:00.000Z

When you run the above code, you will get an iso date format example output.

For now, let’s check the output.


TypeScript, convert date to iso string example
TypeScript, convert date to iso string example

All the best 👍.

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 add items to array in javascript?

Example of add items to array in javascript with step by step guide.

April 30th, 2022 · 1 min read

How to convert date to timestamp in typescript?

TypeScript, convert date to timestamp example.

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