Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / Flash / General Flash Topics / July 2008



Tip: Looking for answers? Try searching our database.

Count up clock based in another time zone

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
welling1977 - 24 Jul 2008 15:44 GMT
I've made a count-up clock. However, I'm trying to get it to work off another
timezone and am having a few problems.
Below is the code I've been working with. I need the clock to display 12 hours
ahead and am unsure as to how to do this. Also, when it reaches a certain date
in the future, I need it to then play another section off the timeline and stop.

Please, any insight is very appreciated!!
Ray_Lea - 27 Jul 2008 04:42 GMT
I can not find a way to add 12 to the clock but you just take 12 off the date
and time, this is my counter and it's my birthday 14 sept so I set it 12 hours
early

var ABC:Number = 1

onEnterFrame = function  () {
   
    var today:Date = new Date();
    var currentYear = today.getFullYear();
    var currentTime = today.getTime();
   
    var myHours = today.getHours();
    var myMinutes = today.getMinutes();
    var mySeconds = today.getSeconds();
   
   
   
    if(myHours<10){
        myHours="0"+myHours
    }
    if(myMinutes<10){
    myMinutes="0"+myMinutes
    }
    if(mySeconds<10){
    mySeconds="0"+mySeconds
    }
       
    var targetDate:Date = new Date(2008,9,13,12);   
    var targetTime = targetDate.getTime();
    var timeLeft = targetTime - currentTime;
       
    var sec = Math.floor(timeLeft/1000);
    var min = Math.floor(sec/60);
    var hrs = Math.floor(min/60);
    var day = Math.floor(hrs/24);
   
    var counter:String = "0:00:00:00";
       
    sec = String(sec % 60);
    if (sec.length < 2){;
        sec = "0" + sec;
    } //end
       
    min = String(min % 60);
    if (min.length < 2){;
        min = "0" + min;
    } //end
       
    hrs = String(hrs % 24);
    if (hrs.length < 2){;
        hrs = "0" + hrs;
    } //end
       
    day = String(day);
   
    if (timeLeft <= 0){;
        counter = "0:00:00:00";
        ABC = 0
    }//end
   
    else{
        counter = day + ":" + hrs + ":" + min + ":" + sec;
    } //end
       
    theTime_txt.text=myHours+":"+myMinutes+":"+mySeconds;
    time_txt.text = counter;
   
}// end end

//Put this in frame 2//

if(ABC <= 0){;
    gotoAndPlay(3);
}
    else gotoAndPlay(1);
//put this in frame 3//
//and have what you want to happen//
stop();
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.