parse string to date typescript code example
Example 1: string to date in typescript
let dateString = '1968-11-16T00:00:00'
let newDate = new Date(dateString);
Example 2: string to date angular
let dateString = '02/05/2020';
let momentVariable = moment(dateString, 'MM-DD-YYYY');
let stringvalue = momentVariable.format('YYYY-MM-DD');
console.log(stringvalue); // outputs 2020-05-02
Example 3: parse date from string in js
Date.parse(dateString)
//dateString is like 2020-10-10 / 2020-10-10T10:20:20
Example 4: string to date in typescript
{{dateString | date:'MM/dd/yyyy'}}