date time format typescript 1

date time format typescript

import { DatePipe } from '@angular/common'
constructor(public datepipe: DatePipe){}
myFunction() { Date();
 const start = this.datepipe.transform(, 'yyyyMMdd\'T\'HHmmss.SSSZ');
import { DatePipe } from '@angular/common'
providers: [DatePipe]

Here is what the above code is Doing:
1. Importing the DatePipe class from the @angular/common package.
2. Adding the DatePipe class to the providers array in the @NgModule decorator.
3. Injecting the DatePipe class into the constructor of the component.
4. Using the DatePipe class to transform the date object into a string.

Similar Posts