简体   繁体   中英

Countdown timer to specific timezone in Flash AS3

Is it possible to create a countdown timer (dd:hh:mm:ss) to 12am central time on the front end only?

So users in all timezones would get a clock that is counting down using central time rather than their current computer time?

I'm trying to do this without using backend scripts, but I'm not sure if its possible. Thanks.

ActionScript 3.0 Language and Components Reference

The Date class lets you retrieve date and time values relative to universal time (Greenwich mean time, now called universal time or UTC) or relative to local time, which is determined by the local time zone setting on the operating system that is running Flash Player.

Using dateUTC you can get universal time (UTC) so you can achieve what you ask supposing all users will have the clock set :P

As far as I know you need a server script that checks time on the server.

The Date class is all you need, set a variable for the final Date and call a new Date object at regular interval to get the current time , work out and display the difference.

As dome mentions , use DateUTC to get universal time.

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/Date.html

There's no need for a server script.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM