Question

So I have a text layer in aftereffects with text source expression:

D = new Date(Date(0));
D.getDate() + "/" + (D.getMonth()+1)

which gives me result like this 29/12 and I need to add 3 days to it. I tried:

D = new Date(Date(0));
(D.getDate()+3) + "/" + (D.getMonth()+1)

But that results to 32/12 .. How do I make it so the result would be (in this particular case) 1/1? In Java people suggest to use calendar class. But I'm not sure if After Effects has such thing.

Was it helpful?

Solution

Try this:

D = new Date(Date(0));
D = new Date(D.getTime()+3*24*60*60*1000);
D.getDate() + "/" + (D.getMonth()+1)

OTHER TIPS

you can use things like this:

       DateTime.Now.AddDays(12);
       DateTime.Now.AddYears(2);

in javascript you can set with the help of setDate() function

       var d = new Date();
       d.setDate(35); // this will give you 4 jan 2013
       d.setDate(25); // this will give you 25 Dec 2012
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top