I have an API where they send me the format 00:25:00
and this I have to pass to a format that looks nice: like this 25:00 min what I had done is this way
const date = new Date("00:25:00");
{format(date, "h:m ")}
but I get an error, and I don't know how to pass this format 00:25:00 to minutes
CodePudding user response:
I have not tested the below one, but just try getting the minutes and seconds
const date = new Date();
const newdate = ("00" date.getMinutes()).slice(-2) ":" ("00" date.getSeconds()).slice(-2);
console.log(newdate);
If you mean to just minutes then remove the .getSeconds()