Timm
Timm

Reputation: 12753

Get current UTC time in actionscript

How do I get the number of milliseconds, in UTC time, since the epoch?

Just like myDate.getTime() returns the milliseconds in local time, I need this in universal (UTC) time.

Any ideas?

Upvotes: 1

Views: 4605

Answers (1)

Brian Hadaway
Brian Hadaway

Reputation: 1893

The ActionScript 2 Date object has a getTimezoneOffset method that will give you the difference between UTC and the local timezone in minutes.

var utc = myDate.getTime() + (myDate().getTimezoneOffset() * 60000);

Upvotes: 3

Related Questions