Navigate back to the homepage

How to convert date to string format in typescript?

Infinitbility
TypeScript
April 25th, 2022 · 1 min read
keep affilitate

Hi Friends 👋,

Welcome to Infinitbility ❤️!

Today, we are going to learn How to convert date to date string format in typescript, here we will use built-in method .toString() to convert date to string date.

First, we will create sample new date() object variable, after then, we will use .toString() method to convert it on string date format.

let’s dive in code…

1let date = new Date();
2console.log(date); // 2022-04-25T08:21:19.833Z
3
4let strDate: string = date.toString()
5console.log(strDate) // 'Mon Apr 25 2022 13:51:13 GMT+0530 (India Standard Time)'

Well, when you run above code, you can able to see date converted in string date format.

For now, let’s check the output.

Output

TypeScript, convert date to string format example
TypeScript, convert date to string format 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

Tutorials

Categories

More articles from Infinitbility

How to convert date to utc format in typescript?

TypeScript, convert date to utc format example.

April 24th, 2022 · 1 min read

How to convert string to char array in typescript?

TypeScript, convert string to char array example.

April 23rd, 2022 · 1 min read
© 2020–2022 Infinitbility
About
Link to $https://medium.com/infinitbilityLink to $https://www.facebook.com/InfinitbilityLink to $https://github.com/infinitbilityLink to $https://twitter.com/infinitbilityLink to $https://www.buymeacoffee.com/infinitbilityLink to $mailto:[email protected]