• | **Countdown(up) to newyear**
on Dec 19, 2012 at 4:40:29 pm |

I am searching the internet for an expression for a text layer to go from 23:50:00 to 23:59:59 (1 second before midnight)

Al the expression i could find are counting down from 10 min to 0 seconds.

Any suggestions? thanks a lot!

• | **Re: Countdown(up) to newyear** on Dec 19, 2012 at 5:37:28 pm |

This should work:

rate = 1;

clockStart = (23*60 + 50)*60;

clockStop = (23*60 + 59)*60 + 59;

function padZero(n){

if (n < 10) return "0" + n else return "" + n

}

clockTime = Math.min(clockStart + rate*(time - inPoint),clockStop);

t = Math.floor(clockTime);

hr = Math.floor(t/3600);

min = Math.floor((t%3600)/60);

sec = Math.floor(t%60);

padZero(hr) + ":" + padZero(min) + ":" + padZero(sec)

Dan

• | **Re: Countdown(up) to newyear** on Dec 19, 2012 at 5:57:03 pm |

Wow Dan, that's exactly what i was looking for! Thank you so much!

• | **Re: Countdown(up) to newyear** on Dec 19, 2012 at 6:15:27 pm |

Hello,

Here's a solution that will get you from 23:50:00 to 24:09:59 using a text layers source text.

You can also use the Text >Timecode Effect if you can handle the default font.

Set your Time Source to custom:

Time Units = 60

Starting Frame = 5148000

`fps = (1/thisComp.frameDuration);`

spm = 60/fps;

fpm = fps*spm

s = Math.floor(Math.floor(time)%fpm);

m = Math.floor(Math.floor(time)/fpm);

if ((s>9) && (m<10)){

"11"+":"+(50+m)+":"+s

} else if ((s<=9) && (m<10)){

"11"+":"+(50+m)+":0"+s

} else if ((s<=9) && (m>=10)){

"12"+":0"+(m-10)+":0"+s

} else if ((s>9) && (m>=10) && (m<20)){

"12"+":0"+(m-10)+":"+s

}

Prepare for today and you'll survive, prepare for tomorrow and you will thrive.