# Countdown to Specific Date #2

**URL:** https://forum.kirupa.com/t/countdown-to-specific-date-2/56203
**Category:** flash
**Created:** [July 1, 2004, 3:24pm UTC](https://forum.kirupa.com/t/countdown-to-specific-date-2/56203 "2004-07-01T15:24:16Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![suzieq](https://avatars.discourse-cdn.com/v4/letter/s/5fc32e/32.png) [@suzieq](https://forum.kirupa.com/u/suzieq)
#### Post date: [July 1, 2004, 3:24pm UTC](https://forum.kirupa.com/t/countdown-to-specific-date-2/56203/1 "2004-07-01T15:24:16Z")

</div>

Help!

I am trying to countdown to a date next year (2005) and cannot seem to manipulate the code to make it work 🙂 Help!

```auto
 eventDate = new Date( 2005, 06, 16 , 18 , 0 , 0 , 0); 

```

What am I doing wrong? Please help.  
This is Flash MX.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 2, 2004, 6:29pm UTC](https://forum.kirupa.com/t/countdown-to-specific-date-2/56203/2 "2004-07-02T18:29:58Z")

</div>

ok i gotta go out tonite an dunno wen ill b bak… :S  
so i thout id post this 4 ya… its not 100% commented and isnt 100% accurate when months change… but aint had much time…  
itd be a lot easier to just hav it counting down with months as well… but u asked for days… so i will giv u days… just u gotta giv me bit mor time im afraid… :S sorry!!

neway, heres the uncommented half code that will work… ish…  
post asap wit proper version 4u…

just set a dynbamic text boxes variable to “StringCD” (without quotes) k?

```auto

	//Event Date = 16-7-2005
	EvenD = 16
	EvenM = 7
	EvenY = 2005
	monthsDays = new Array(31,28,31,30,31,30,31,31,30,31,30,31)//this is an array containing the number of days in each month...
if(StartCount!=false){
	CountDown = setInterval(Rem,1000)
	StartCount = false
}
function Rem(){
	Current = new Date()
	CY = Current.getFullYear()
	CM = Current.getMonth()+1
	CurrD = Current.getDate()
	CurrM = Current.getMinutes()
	CurrH = Current.getHours()
	while(CurrD!=Day){
		Day = CurrD
		calc = true
	}
	if(calc == true){
		LeftD = 0
		LeftMo = 0
	if(EvenY == CY){
		ML = (EvenM-CM)-1 // calculates number of FULL months remaining when the event year = current year
		if(LeftMo <0){
			LeftMo = 0
		}
	}
	else{
		ML = ((((EvenY-CY)*12)-CM)+EvenM)-1//calculates number of FULL months remaining
	}
	LeftD = monthsDays[CM]-CurrD
	if( CM == EvenM && CY == EvenY){
		LeftD = EvenD-CurrD
	}
	else{
		LeftD += EvenD
	}
	
		MLa = ML
		for(MLb=ML;MLb!=0;MLb--){
			MLa ++
			if(MLa == 13){
				MLa = 1
			}
			LeftMo+=monthsDays[MLa+1]
			trace(MLa)
		}
		calc = false
		LeftD += LeftMo-2
	}
	
		LeftM = 60-CurrM
		if(LeftM <10){
			LeftM = "0"+LeftM
		}
		LeftH = 23-CurrH
		if(LeftH <10){
			LeftH = "0"+LeftH
		}
		StringCD = ""
		StringCD = LeftD + " Days, " + LeftH + " Hours, " + LeftM + " Minutes"
}

```

just stick that on the first frame… note you only want to run this script once so u mite wanna add an if(sumVar!=true){…[code above]… ; sumVar = true} in ifu have multiple frames…

sorry i cant givu finished product just yet but i really gtg… :S

Prophet.
