# Problem with countdown and different timezones

**URL:** https://forum.kirupa.com/t/problem-with-countdown-and-different-timezones/236625
**Category:** Uncategorized
**Created:** [August 22, 2007, 11:36am UTC](https://forum.kirupa.com/t/problem-with-countdown-and-different-timezones/236625 "2007-08-22T11:36:27Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![jetjaguar](https://avatars.discourse-cdn.com/v4/letter/j/6de8d8/32.png) [@jetjaguar](https://forum.kirupa.com/u/jetjaguar)
#### Post date: [August 22, 2007, 11:36am UTC](https://forum.kirupa.com/t/problem-with-countdown-and-different-timezones/236625/1 "2007-08-22T11:36:27Z")

</div>

Hi!  
On my website I need to have a counter that count down to a specific date and time. All works as it should except that I can’t figure out how to make the counter shoe the correct time for people in different timezones. If anyone would be able to help me as soon as possible I would be very thankful…

Cheers!

**This is the actionscript:**

this.onEnterFrame = function() {

var today:Date = new Date();  
var currentYear = today.getFullYear();  
var currentTime = today.getTime();

var targetDate:Date = new Date(currentYear,7,25,18,0,0);  
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 days = Math.floor(hrs/24);  
sec = string(sec % 60);  
if (sec.length \< 2) {  
sec = “0” + sec;  
}  
min = string(min % 60);  
if (min.length \< 2) {  
min = “0” + min;  
}  
hrs = string(hrs % 24);  
if (hrs.length \< 2) {  
hrs = “0” + hrs;  
}  
days = string(days);

var counter:String = days + “:” + hrs + “:” + min + “:” + sec;  
time\_txt.text = counter;  
}
