Navigate back to the homepage

How to convert string to date in typescript?

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

Hi Friends 👋,

Welcome to Infinitbility ❤️!

Today, I’m going to show you how to convert string to date object in typescript, here we will use new Date() method to convert date string to date.

Let’s start the code.

Suppose, you will get '1968-11-16T00:00:00' this type of string from api and want use as a date then you have to pass this string in date object like this new Date('1968-11-16T00:00:00').

After that you can perform any date operation on thet.

1let dateString = '1968-11-16T00:00:00'
2let newDate = new Date(dateString)

Output

TypeScript, convert string to date example
TypeScript, convert string to date 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 add catch light to eyes in photoshop?

Change eye color in photoshop example with a step-by-step guide with images.

April 3rd, 2022 · 1 min read

How to define array of objects in typescript?

TypeScript, create array of object example with data type.

March 29th, 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]