View Single Post
  #2 (permalink)  
Old 07-27-2008, 05:53 AM
Ray_Lea
 
Posts: n/a
Diggs:
Default Re: Count up clock based in another time zone

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 todayate = 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 targetDateate = 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+":"+mySecon ds;
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();

Reply With Quote