I am trying to figure out how to get current time in different time zones but below method does not return anything
var timeUpdate = setInterval(function () {
var currentTime = moment().format()
var GMT_current_time = currentTime.tz("Europe/London").format("HH:mm DD MMM");
$("#GMT_display_time").text(GMT_current_time);
}, 1000);
The output of the format
function is a string. The tz
function works on a moment object.
moment().tz("Europe/London")
Returns current time with format.
moment.tz(moment(), 'Asia/Karachi').format('DD/MM/YYYY HH:mm')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With