Check out example codes for "angular get current date yyyy-mm-dd". It will help you in understanding the concepts better.

Code Example 1

import { DatePipe } from '@angular/common';

@Component({
    templateUrl: './name.component.html',
    styleUrls: ['./name.component.scss'],
    providers: [DatePipe]
})

myDate = new Date();
constructor(private datePipe: DatePipe){
    this.myDate = this.datePipe.transform(this.myDate, 'yyyy-MM-dd');
}

Learn ReactJs, React Native from akashmittal.com