We are currently using the following in our code to get the UTC Time:
date.format("isoDateTime")
How do you get the UTC Time in javascript?
We are currently using the following in our code to get the UTC Time:
date.format("isoDateTime")
How do you get the UTC Time in javascript?
Date objects come with a toISOString()
method. Assuming date
is your JavaScript date object, you can simply call:
date.toISOString();
.toISOString()
is good for string. If you need JavaScript date object use
var getUtcTime = function() {
var d = new Date();
return d.getTime() + d.getTimezoneOffset() * 60 * 1000;
};