Format string date into date object

Samir

I have a date in this format: December 5th 2017. How do I convert it to either a timestamp or a date object?

I tried the following but it return NaN: let tDate = new Date('December 5th 2017')

Korgen

use a library like moment.js (momentjs.com) to parse custom date formats into Dates. As of version 2.13 it apparently comes with typings out of the box and can therefore be used easily with TypeScript (aureliajsrocks.com/moment-js-now-typescript-compatbile)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related