Answers for "change date format in typescript angular 9"

2

ts change date format

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 May-04-2020
1

angular change how date looks

// use Angular DatePipe
{{ dateObj | date: 'format desired' }}

{{ dateObj | date:'shortDate' <or> 'M/d/yy' }}    // output is '1/25/21'
{{ dateObj | date:'mediumDate' <or> 'MMM d, y' }} // output is 'Jan 25, 2021'
{{ dateObj | date:'longDate' <or> 'MMMM d, y' }}  // output is 'January 25, 2021'
Posted by: Guest on January-25-2021

Code answers related to "change date format in typescript angular 9"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language