Check out example codes for "show timestamp as yyyy mm dd html angular". It will help you in understanding the concepts better.

Code Example 1

{{date  | date:'yyyy-MM-dd'}}

Code Example 2

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'); }

Code Example 3

import { DatePipe } from '@angular/common' ... providers: [DatePipe]

Learn ReactJs, React Native from akashmittal.com