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

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.