convert string to date in 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: string to date in typescript
{{dateString | date:'MM/dd/yyyy'}}