TwelvestoneFlash

time zone


Sign in

  • Waiting for Godot ( 720 k posts )
    Just conversation.
  • Thunder Dome ( 23 k posts )
    Photoshop Tennis and Collabs.
  • Photography ( 4.8 k posts )
    For all you shutterbugs, sh...
  • Flash ( 18 k posts )
    ActionScripting to tweens, ...
  • Front End ( 5.8 k posts )
    general front end design an...
  • Back End ( 9.6 k posts )
    serverside scripting, progr...
  • Projects and Theory ( 12 k posts )
    This forum is for discussio...
  • FAQ ( 269 posts )
    All those nagging questions...
  • Design ( 17 k posts )
    graphics & all aspects of g...
  • Purgatory ( 3.6 k posts )
    12stone Jail, feel free to ...
arigato
 
2009-04-24

Working on a clock, very simple stuff:

onClipEvent (enterFrame) { time = new Date(); mil = time.getMilliseconds(); s = time.getSeconds(); m = time.getMinutes(); h = time.getHours(); seconds._rotation = s*6+(mil/(1000/6)); minutes._rotation = m*6+(s/10); hours._rotation = h*30+(m/2); }

How do i get it to display a different time zone?

baron ruhstoff
 
2009-04-24

Found this:

public static function getTimezone():Number { // Create two dates: one summer and one winter var d1 : Date = new Date( 0, 0, 1 ) var d2 : Date = new Date( 0, 6, 1 )

// largest value has no DST modifier var tzd:Number = Math.max( d1.timezoneOffset, d2.timezoneOffset )

// convert to milliseconds return tzd * 60000 }

public static function getDST( d : Date ):Number { var tzd : Number = getTimezone() var dst : Number = (d.timezoneOffset * 60000) - tzd return dst }

AS3 reference for Date.timezoneOffset

arigato
 
2009-04-24

OK, I get how to add offsets. Let me rephrase the question:

I have to create a single application with a set of 3 clocks, one for EST, one for Central, one for Pacific Time.

The application will be viewed by users in each of these time zones.

I need to be able to display variance from GMT so the time displays accurately regardless of the user's time zone...

so how do I call GMT?

baron ruhstoff
 
2009-04-24

Date.timezoneOffset gives you the number of minutes between UTC and the time as described by the client's machine. My guess is that you would:

  • figure out the local time,
  • determine the timezone offset for each of the three timezones,
  • create three clocks with an initial value defined by UTC,
  • apply anoffset to each clock,
  • profit

Maybe?

(caveat: Haven't tried this myself. Just off the top of my head.)

baron ruhstoff
 
2009-04-24

fyi: If you output a Date object as a string, you get something that follows this format: Day Mon DD HH:MM:SS TZD YYYY

TZD is the timezone offset for the local time relative to GMT.

For example, outputting new Date() gives me the following: Fri Apr 24 10:53:33 GMT-0400 2009

Being on EST, adding 4 hours will give me GMT.

I think. k

arigato
 
2009-04-24

I used the UTC & just subtracted the hours offset. Seems to work fine. For example, Montreal time: onClipEvent (enterFrame) { time = new Date(); mil = time.getMilliseconds(); m = time.getMinutes(); h = time.getUTCHours()-4; yul_minutes._rotation = m*6+(s/10); yul_hours._rotation = h*30+(m/2); }

Thanks!

Sorry, you must be a member to post to a conversation. Either log in or sign up to get involved.
TwelvestoneFlash

time zone