I want to show time in 12 hours format without using the AM
and PM
. For example 3:45
only and not 3:45 PM
or 3:45 AM
. How I can modify the toLocaleTimeString()
to not show the PM
AM
but in 12 number format?
var minsToAdd = 45;
var time = "15:00";
var newTime = new Date(new Date("2000/01/01 " + time).getTime() + minsToAdd * 60000).toLocaleTimeString('en-US', { hour: '2-digit', minute: '2-digit', hour12: true });
console.log(newTime);