Home > Software design >  Javascript get Date format in H:M:S using react js
Javascript get Date format in H:M:S using react js

Time:09-26

First I'll say that I've tried the solution in enter image description here

Is it related to how react-js is working or am I writing the javascript code wrong?

CodePudding user response:

you can do it like this:

//your date
 let temp = new Date(); 
 let HMS = `${temp.getHours()}:${temp.getMinutes()}:${temp.getSeconds()}`

and now you have your hours:minutes:seconds

  • Related