2

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?

2

3 Answers 3

2

Date objects come with a toISOString() method. Assuming date is your JavaScript date object, you can simply call:

date.toISOString();
Sign up to request clarification or add additional context in comments.

Comments

1

.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;
    };

Comments

0

var d=new Date(Date.UTC(2013,10,09));

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.