Answers for "angular convert date"

4

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
Posted by: Guest on May-11-2020
2

show timestamp as yyyy mm dd html angular

{{date  | date:'yyyy-MM-dd'}}
Posted by: Guest on February-17-2020
1

show timestamp as yyyy mm dd html angular

import { DatePipe } from '@angular/common'
...
constructor(public datepipe: DatePipe){}
...
myFunction(){
 this.date=new Date();
 let latest_date =this.datepipe.transform(this.date, 'yyyy-MM-dd');
}
Posted by: Guest on February-17-2020

Code answers related to "angular convert date"

Browse Popular Code Answers by Language