A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Looking for help with Timezone clock.

  1. #1
    Junior Member
    Join Date
    Aug 2012
    Posts
    10

    Looking for help with Timezone clock.

    I'm looking for a digital clock code, That works off a time zone not my computers time.

    The time zone is Paris UTC+1


    Any help is awesome Thank you.

  2. #2
    Prid - Outing Nig 13's Avatar
    Join Date
    Jul 2006
    Location
    Norway
    Posts
    1,864
    Actionscript 2.0:

    Actionscript Code:
    onEnterFrame = function(){
        time = new Date();
       
        timeZoneOffset = 1; // change this to change the offset
       
        hours = time.getUTCHours()+timeZoneOffset;
        minutes = time.getUTCMinutes();
        seconds = time.getUTCSeconds();
        if(hours >= 24){
            hours -= 24;
        }
        if(hours < 10){
            hours = "0"+hours;
        }
        if(minutes < 10){
            minutes = "0"+minutes;
        }
        if(seconds < 10){
            seconds = "0"+seconds;
        }
        trace(hours+":"+minutes+":"+seconds);
    }
    I am back, guys ... and finally 18 :P

    BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS

  3. #3
    Junior Member
    Join Date
    Aug 2012
    Posts
    10
    Hey thanks for response but I forgot to mention that it has to be actionscript3.0
    Quote Originally Posted by Nig 13 View Post
    Actionscript 2.0:

    Actionscript Code:
    onEnterFrame = function(){
        time = new Date();
       
        timeZoneOffset = 1; // change this to change the offset
       
        hours = time.getUTCHours()+timeZoneOffset;
        minutes = time.getUTCMinutes();
        seconds = time.getUTCSeconds();
        if(hours >= 24){
            hours -= 24;
        }
        if(hours < 10){
            hours = "0"+hours;
        }
        if(minutes < 10){
            minutes = "0"+minutes;
        }
        if(seconds < 10){
            seconds = "0"+seconds;
        }
        trace(hours+":"+minutes+":"+seconds);
    }

  4. #4
    Prid - Outing Nig 13's Avatar
    Join Date
    Jul 2006
    Location
    Norway
    Posts
    1,864
    Actionscript Code:
    import flash.events.Event;

    addEventListener(Event.ENTER_FRAME, showTime);

    function showTime(e:Event){
        var time:Date = new Date();
       
        var timeZoneOffset:Number = 1; // change this to change the offset
       
        var hours = time.getUTCHours()+timeZoneOffset;
        var minutes = time.getUTCMinutes();
        var seconds = time.getUTCSeconds();
        if(hours >= 24){
            hours -= 24;
        }
        if(hours < 10){
            hours = "0"+hours;
        }
        if(minutes < 10){
            minutes = "0"+minutes;
        }
        if(seconds < 10){
            seconds = "0"+seconds;
        }
        trace(hours+":"+minutes+":"+seconds);
    }
    I am back, guys ... and finally 18 :P

    BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center