moment format 23 hour 1

moment format 23 hour

let dt = moment();
dt.format("HH:mm") // 24 hour time
dt.format("hh:mm a") // 12 hour time (with am/pm)

Here is what the above code is Doing:
1. We import the moment library.
2. We create a variable called dt and assign it the current date and time.
3. We format the date and time in two different ways.

Similar Posts