Trim Date Format Primeng Calendar - Remove Timestamp, Angular Reactive Forms
I have the following pushed into my reactive forms obj 2016-01-01T00:00:00.000Z but I want the following 2016-01-01. Does anyone know of a built in function to achieve the above. I
Solution 1:
You need to inject DatePipe in your component, as
constructor( private datePipe: DatePipe){}
than you can use wherever in the component the transform function
const formattedDate = this.datePipe.transformer(dateValue, 'build_in_date_format')
there are many build in formats, refer to the official documentation https://angular.io/api/common/DatePipe
Post a Comment for "Trim Date Format Primeng Calendar - Remove Timestamp, Angular Reactive Forms"