Josh
Josh

Reputation: 109

How to convert Date().getTime() to UTC

I currently have this code below in javascript but it is currently at it's default timezone which is PST but I want it to be UTC by default or a way to convert it to UTC.

What are some ways around it?

var now = new Date().getTime();

Upvotes: 0

Views: 388

Answers (1)

Hien Nguyen
Hien Nguyen

Reputation: 18975

You can use var now = new Date().toISOString();

var now = new Date().toISOString();
console.log(now)

Upvotes: 1

Related Questions