We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
date arithmetic (Read 1183 times)
date arithmetic
Jun 18th, 2008, 7:26am
 
are there date functions somewhere that would let me populate an array with one element for each day in a three year period?

eg: dateadd(d,1,today's date) would return tomorrow's date
Re: date arithmetic
Reply #1 - Jun 18th, 2008, 10:01am
 
there is a Java class called Calendar for such things.

I think the syntax is something like
Code:
//init a new calendar to today's date
Calendar calendar = Calendar.getInstance();
// add one day
calendar.add(DAY, 1);
// print the result
println(calendar.get(YEAR));
println(calendar.get(MONTH));
println(calendar.get(DAY));


but you should check the reference :
http://java.sun.com/j2se/1.4.2/docs/api/java/util/Calendar.html
Page Index Toggle Pages: 1