Angular Material Date Picker Formater
Angular Material Date Picker Formate:
1.) Import in Main module and Provider [
import {DatePipe} from '@angular/common';
imports: [
BrowserModule,
....
],
entryComponents: [],
declarations: [],
bootstrap: [],
providers: [DatePipe]
})
export class AppModule {}
2.) Import in Component wher u can use
import { DatePipe } from '@angular/common';
Toset:
constructor(private DatePipe:DatePipe){
this.startDate= new Date('04/06/2019');
}
To get:
let data = this.DatePipe.transform(this.startDate, 'MM/dd/yyyy')
Example :
https://stackblitz.com/edit/angular-cyseqq?file=app/datepicker-value-example.ts
Comments
Post a Comment