I need to get current date in ‘yyyy-MM-dd’ format having Date
datatype.
I tried below
public today = new Date();
public currentDate = this.datepipe.transform(this.today, 'yyyy-MM-dd');
When I console following it gives me currentDate
as string
but I need currentDate
in Date
datatype.
console.log('current date', this.currentDate); //output 2022-11-09
console.log('type if currentDate', typeof(this.currentDate)); //output string
How I can get currentDate in Date
datatype? or is there any other way to get this? Please help.