Advertisement

TrimwebsolutionsTrimwebsolutions

Problem and Solutions

Convert 2022-04-20T17:00:00.000Z to timepicker format in react.js ?

By M.K. Verma · 2 May 2022

Convert 2022-04-20T17:00:00.000Z to timepicker format in react.js ?

you can simply new Date()

new Date('2022-04-20T17:00:00.000Z');

like this to convert given timestamp into required format

then you can also extract only the part you want

var d = new Date('2022-04-20T17:00:00.000Z');
console.log(d.getUTCHours()); // Hours
console.log(d.getUTCMinutes()); //Minutes
console.log(d.getUTCSeconds()); //Seconds