How to extract Date only from Datetime with Date type?

Viewed 22

I want to extract only date from this 2022-05-16T18:30:00.000Z and it is in date format.

I want only 2022-05-16

how can I achieve this one ?

2 Answers

This might help you

 var date = new Date("2022-03-10T02:00:00Z");
date.toISOString().substring(0, 10);

Also might check on this iso to date

'2022-05-16T18:30:00.000Z'.replace(/T.*/, '')
// '2022-05-16'
Related