Scenario :
I need to change the date format from my .ts code file .
Solution :
We take advantage of , already exists angular 2 "DatePipe" , like the following :
// ----------- Inside My Component Controller .ts file ----------------------
import { DatePipe } from '@angular/common';
@Component({
.....
providers: [DatePipe]
})
constructor(
private _datePipe: DatePipe,
.....
myTestFunc(){
let datePipeTest = this._datePipe.transform(this.task.scheduledStart, 'dd/MM/yyyy');
consol.log(datePipeTest);
}
No comments:
Post a Comment