• | **Expression for Digital 24 Hours clock**
on Oct 14, 2005 at 1:02:05 pm |

I am looking for a smarter way to build a count down 24 hours clock.

I couldnt find the right plugin for this (the text number effect - is not good for 24 hours count down and has no 100/th of a sec.)

Doing this with key frames seem to me no too effecient.

I was thinking maybe anyone of you is familiar with plug in or if it could be done with animation Expression.

Tnx for any help

Gil

• | **Re: Expression for Digital 24 Hours clock** on Oct 14, 2005 at 5:30:51 pm |

24 hour count down clock (expression for text layer source text):

// 24 hour count down clock

beginHr = 23;

beginMin = 59;

beginSec = 59;

beginHun = 0;

beginTime = (beginHr*60 + beginMin)*60 + beginMin + beginHun/100;

function digits(myVal,myNumDigits){

var s = myVal.toString();

while (s.length < myNumDigits) s = '0' + s;

return s;

}

currTime = beginTime - time;

hr = digits(Math.floor(currTime/3600),2);

min = digits(Math.floor((currTime%3600)/60),2);

sec = digits(Math.floor(currTime)%60,2);

hun = digits(Math.floor(currTime%1*100),2);

hr + ":" + min + ":" + sec + "." + hun

Dan

• | **Re: Expression for Digital 24 Hours clock - oops** on Oct 14, 2005 at 6:22:50 pm |

You'd think I'd have learned by now to always try it before posting. This should work better:

beginHr = 3;

beginMin = 0;

beginSec = 1;

beginHun = 0;

beginTime = (beginHr*60 + beginMin)*60 + beginSec + beginHun/100;

function digits(myVal,myNumDigits){

var s = myVal.toString();

while (s.length < myNumDigits) s = '0' + s;

return s;

}

currTime = beginTime - time;

hr = digits(Math.floor(currTime/3600),2);

min = digits(Math.floor((currTime%3600)/60),2);

sec = digits(Math.floor(currTime)%60,2);

hun = digits(Math.floor(currTime%1*100),2);

hr + ":" + min + ":" + sec + "." + hun

Dan

• | **Re: Expression for Digital 24 Hours clock - oops** on Oct 15, 2005 at 8:02:53 am |

Dan

Thank you very vewry much for your serious respond.

i will try it your way

i quess i should take some tutorials in expression methods.

thanx alot.

Gil

• | **Re: Expression for Digital 24 Hours clock - oops** on Aug 25, 2011 at 7:08:15 pm |

I'm trying to modify this to make a 48 hour countdown. I've got the numbers correct, but I want to try and get the numbers under 10 to display with a zero in front of them. Any tips for that? I tried just changing the begin values, but that didn't work at all (it didn't mess up the expression at all though, so I left it).

Thanks.

`beginHr = 48;`

beginMin = 00;

beginSec = 00;

beginHun = 00;

beginTime = (beginHr*60 + beginMin)*60 + beginSec + beginHun/100;

function digits(myVal,myNumDigits){

var s = myVal.toString();

while (s.length) return s;

}

currTime = beginTime - time;

hr = digits(Math.floor(currTime/3600),2);

min = digits(Math.floor((currTime%3600)/60),2);

sec = digits(Math.floor(currTime)%60,2);

hun = digits(Math.floor(currTime%1*100),2);

hr + ":" + min + ":" + sec + "." + hun

• | **Re: Expression for Digital 24 Hours clock - oops** on Aug 25, 2011 at 7:53:46 pm |

You didn't get the whole expression. Try this:

beginHr = 48;

beginMin = 0;

beginSec = 0;

beginHun = 0;

beginTime = (beginHr*60 + beginMin)*60 + beginSec + beginHun/100;

function digits(myVal,myNumDigits){

s = myVal.toString();

while (s.length < myNumDigits) s = "0" + s;

return s;

}

currTime = beginTime - time

hr = digits(Math.floor(currTime/3600),2);

min = digits(Math.floor((currTime%3600)/60),2)

sec = digits(Math.floor(currTime)%60,2);

hun = digits(Math.floor(currTime%1*100),2);

hr + ":" + min + ":" + sec + "." + hun

Dan

• | **Re: Expression for Digital 24 Hours clock - oops** on Aug 25, 2011 at 7:57:22 pm |

That works. Thanks! Now I just have to find a fixed width font that looks decent so it doesn't look like it's jumping around as much.

• | **Re: Expression for Digital 24 Hours clock - oops** on Sep 23, 2011 at 3:24:13 am |

thanks for posting this.

I want to do the same thing but be able to set a key frame and run it not in real time. For example 20 hours down to 0 in 30 seconds.

Thanks for you help

• | **Re: Expression for Digital 24 Hours clock - oops** on Sep 23, 2011 at 6:25:34 am |

I'm not sure what you want to keyframe, but to run it faster than real time, you just need to add a rate variable, like this:

rate = 2400;

beginHr = 20

beginMin = 0;

beginSec = 0;

beginHun = 0;

beginTime = (beginHr*60 + beginMin)*60 + beginSec + beginHun/100;

function digits(myVal,myNumDigits){

s = myVal.toString();

while (s.length < myNumDigits) s = "0" + s;

return s;

}

currTime = beginTime - time*rate;

hr = digits(Math.floor(currTime/3600),2);

min = digits(Math.floor((currTime%3600)/60),2);

sec = digits(Math.floor(currTime)%60,2);

hun = digits(Math.floor(currTime%1*100),2);

hr + ":" + min + ":" + sec + "." + hun

That should count down 20 hours in 30 seconds.

Dan

• | **Re: Expression for Digital 24 Hours clock - oops** on Sep 28, 2011 at 6:38:43 pm |

Dan

Thanks so much for your help I may have an easy job for you

Thanks so much

Gordon

gfales@sbcglobal.net

• | **Re: Expression for Digital 24 Hours clock - oops** on Sep 28, 2011 at 7:04:53 pm |

Dan

will you send me an email?

I may have an easy job for you

Thanks so much for your help

Gordon

gfales@sbcglobal.net

• | **Re: Expression for Digital 24 Hours clock - oops** on Nov 12, 2016 at 9:55:09 pm |

Hi Dan Ebberts/everyone.

I am trying to figure our an expression for DAYS: HOURS: MINUTES: SECONDS countdown. I have been playing with the codes Dan provides but I don't really know that much about expressions and I cannot figure it out. Dan's expressions work like a charm but are for other types of countdowns (most without days). Could you help me find an expression for this if there is one or help me figure out how to accomplish this?

Thank you!!!

• | **Re: Expression for Digital 24 Hours clock - oops** on Nov 19, 2016 at 8:12:33 am |

Hello Sara,

You can try my preset

*Counter Pro*, to create easily timers and countdowns ?

It's free :

http://www.guillaumegallot.fr/tools/counter-pro
++

• | **Re: Expression for Digital 24 Hours clock** on Mar 13, 2006 at 4:18:01 am |

Dan/Anyone

what is taking place here in your expression:

function digits(myVal,myNumDigits){

var s = myVal.toString();

while (s.length < myNumDigits) s = '0' + s;

return s;

}

i can follow the rest but am having trouble with what "function" is performing (adobe help, wasnt) then waht is the digits command accomplishing... s i take it is getting the length of myVal

i think i can figure it from there... just am not sure what is happening at the beginning...

i have to write a clock that starts at a specific point and stops at a specific point over a specified period... i.e. clock starts at 30.0 seconds and over 2 second climb to 43.14 seconds.

thanks,