ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Date countdown?

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
John Palaganas
Date countdown?
on Jun 22, 2009 at 12:42:59 am

Hey 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.
John


Return to posts index

John Palaganas
Re: Date countdown?
on Jun 22, 2009 at 12:51:51 am

It's all good, found it! Effects -> Numbers (Format: Long Date)

Thanks!!!


Return to posts index

Filip Vandueren
Re: Date countdown?
on Jun 22, 2009 at 6:46:49 am

Thankfully, 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.



Return to posts index


John Palaganas
Re: Date countdown?
on Jun 22, 2009 at 2:19:54 pm

Thanks Filip! Will try this as well!
John


Return to posts index

Filip Vandueren
Re: Date countdown?
on Jun 22, 2009 at 5:34:48 pm

I can't get the Numbers thing to work with dates before 12/11/1912, slider=-30000 but this maybe a Mac limitation.



Return to posts index

Liyana Ghafar
Re: Date countdown?
on Nov 14, 2012 at 2:35:11 pm

Hi.
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


Return to posts index


Dan Ebberts
Re: Date countdown?
on Nov 14, 2012 at 8:18:45 pm

Something like this could work:

startDate = "Apr 30 2012";
endDate = "Feb 25 1980";
rate = 2; // counts per second

d1 = 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 + "/" + yr



Dan



Return to posts index

Wiktor Osiecki
Re: Date countdown?
on Nov 25, 2013 at 10:33:33 pm

I have to put that script into File > Script > Script Editor or into Numbers effect?


Return to posts index

Dan Ebberts
Re: Date countdown?
on Nov 25, 2013 at 10:48:48 pm

It's an expression that you would apply to a text layer's Source Text property.

Dan



Return to posts index


Wiktor Osiecki
Re: Date countdown?
on Nov 25, 2013 at 11:05:46 pm

It's working like a charm! Thank You!


Return to posts index

Patrick Grossien
Re: Date countdown?
on Feb 22, 2017 at 4:04:14 pm

Dan, this is fabulous. Much better than the numbers effect because of the better font control!

Is there a way to control the start and end date via keyframes instead of the rate?
And also: is there a way to add a time counter to it so I can also end at any given date & time?

Thanks so much!


Return to posts index

Patrick Grossien
Re: Date countdown?
on Feb 26, 2017 at 3:23:09 pm
Last Edited By Patrick Grossien on Feb 26, 2017 at 3:26:15 pm

[Sorry for the double post - I'm just not sure if the reply was done in the correct place.]

Dan, this is fabulous. Much better than the numbers effect because of the better font control!

Is there a way to control the start and end date via keyframes instead of the rate?
And also: is there a way to add a time counter to it so I can also end at any given date & time?

Thanks so much!


Return to posts index


Dada Lunke
Re: Date countdown?
on Nov 18, 2014 at 12:26:19 pm

Hi,

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
20

Thanks 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();


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]