# Countdown clock

**URL:** <https://forum.kirupa.com/t/countdown-clock/254924>\
**Category:** Uncategorized\
**Created:** [March 17, 2008, 12:24pm UTC](https://forum.kirupa.com/t/countdown-clock/254924 "2008-03-17T12:24:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![andyryan](https://avatars.discourse-cdn.com/v4/letter/a/edb3f5/32.png) [@andyryan](https://forum.kirupa.com/u/andyryan)\
**Post date:** [March 17, 2008, 12:24pm UTC](https://forum.kirupa.com/t/countdown-clock/254924/1 "2008-03-17T12:24:07Z")

</div>

Hi  
i am working on a website that includes a monthly countdown clock to a lottery draw.  
To achieve this i have used a video tutorial from [learnflash.com](http://learnflash.com) and th code as below:

this.onEnterFrame = function() {

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

var targetDate:Date = new Date(2008,2,30);
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 &lt; 2) {
    sec = "0" + sec;
}
min = string(min % 60);
if (min.length &lt; 2) {
    min = "0" + min;
}
hrs = string(hrs % 24);
if (hrs.length &lt; 2) {
    hrs = "0" + hrs;
}
days = string(days);

var counter:String = days + ":" + hrs + ":" + min;
time_text.text = counter;

```

}

i was wondering if anyone knew how to edit this so that i can specify a time on the target date…at the moment it counts down to the day itself ie. midnight the day before. If i wanted to specify midday or something how might i do this?

thanks.
