Activity › Forums › Adobe After Effects Expressions › Date countdown?
-
Date countdown?
Posted by John Palaganas on June 22, 2009 at 12:42 amHey guys,
Been an avid viewer on the forum and site but finally something I can’t figure out 🙂
Expressions is not my forte, can you guys point me out on how to do a date countdown by day?
Let’s say I can start a specific date (August 21, 2029) to countdown to (June 1, 1887).
So the first thing that countsdown is the day then month then year. Is it very hard?
Thank you to anyone that can point me to the right direction.
JohnDan Darling replied 5 years, 5 months ago 9 Members · 15 Replies -
15 Replies
-
John Palaganas
June 22, 2009 at 12:51 amIt’s all good, found it! Effects -> Numbers (Format: Long Date)
Thanks!!!
-
Filip Vandueren
June 22, 2009 at 6:46 amThankfully, the javascript Date() object works in After Effects:
monthnames=["january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december"];date_1=new Date(2029,7,21); // watchout month 0=januari, 11=:december !
milli_1=date_1.getTime();date_2=new Date(1887,5,1);
milli_2=date_2.getTime();//interpolate from 0 to 5 seconds;
t=linear(time,0,5,milli_1,milli_2);date_3=new Date(t);
monthnames[date_3.getMonth()] + " " + date_3.getDate() + " " + date_3.getFullYear();
You’ll probably want to control the interpolation with a slider instead of directly throught time.
-
Filip Vandueren
June 22, 2009 at 5:34 pmI can’t get the Numbers thing to work with dates before 12/11/1912, slider=-30000 but this maybe a Mac limitation.
-
Liyana Ghafar
November 14, 2012 at 2:35 pmHi.
Im new to this adobe after effects. I want to make date countdown (e.g present date reverse to past date (30/04/2012 –> 25/02/1980) effect). But I dont know how to with this script. Please help. Thnks -
Dan Ebberts
November 14, 2012 at 8:18 pmSomething like this could work:
startDate = “Apr 30 2012”;
endDate = “Feb 25 1980”;
rate = 2; // counts per secondd1 = new Date(startDate);
d2 = new Date(endDate);
msPerDay = 24*60*60*1000;
t = Math.floor((time-inPoint)*rate);
ms = Math.max(d1.getTime() – t*msPerDay,d2);
d = new Date(ms);
dy = “” + d.getDate();
mo = “” + (d.getMonth()+1);
yr = “” + d.getFullYear();
if (dy.length < 2) dy = “0” + dy;
if (mo.length < 2) mo = “0” + mo;
dy + “/” + mo + “/” + yrDan
-
Wiktor Osiecki
November 25, 2013 at 10:33 pmI have to put that script into File > Script > Script Editor or into Numbers effect?
-
Dan Ebberts
November 25, 2013 at 10:48 pmIt’s an expression that you would apply to a text layer’s Source Text property.
Dan
-
Dada Lunke
November 18, 2014 at 12:26 pmHi,
im new here so I apologise if this post isnt ok in any way 🙂
I pasted your code the the source text layer and it works great.
But how can I switch rows/lines so that the month name is in line1,
the day is in line2 and the month is in line3? 🙁For Example:
November
19
20Thanks in advance 🙂
monthnames=["JANUARY", "FEBRUARY", "MARCH", "APRIL", "MAY", "JUNE", "JULY", "AUGUST", "SEPTEMBER", "OCTOBER", "NOVEMBER", "DECEMBER"];date_1=new Date(2055,12,12); // watchout month 0=januari, 11=:december !
milli_1=date_1.getTime();date_2=new Date(2015,3,1);
milli_2=date_2.getTime();//interpolate from 0 to 5 seconds;
t=linear(time,5,0,milli_1,milli_2);date_3=new Date(t);
monthnames[date_3.getMonth()] + " " + date_3.getDate() + " " + date_3.getFullYear();
Reply to this Discussion! Login or Sign Up