R
Ryan
I have a simple java application which needs to pick a date off in the
future some time. I'm using the roll method, to simply jump out some
number of days ahead.
Then I attempt to print out the new day with a simple date
formatter....
---------------------
Calendar cal = Calendar.getInstance();
cal.roll(Calendar.DAY_OF_YEAR, 70);
SimpleDateFormat dateFormat = new SimpleDateFormat("MM/dd/yy");
System.out.println("New Date: "+dateFormat.format(cal.getTime()));
--------------------
Here is the output:
New Date: 02/27/07
As you can see, it thinks the new date is still in 2007 and not 2008.
However, it did pick the right day. Feb 27, 2008 is 70 days out from
today (Dec 19).
This Calendar object is a bit tricky....
Any help would be great.
Ryan
future some time. I'm using the roll method, to simply jump out some
number of days ahead.
Then I attempt to print out the new day with a simple date
formatter....
---------------------
Calendar cal = Calendar.getInstance();
cal.roll(Calendar.DAY_OF_YEAR, 70);
SimpleDateFormat dateFormat = new SimpleDateFormat("MM/dd/yy");
System.out.println("New Date: "+dateFormat.format(cal.getTime()));
--------------------
Here is the output:
New Date: 02/27/07
As you can see, it thinks the new date is still in 2007 and not 2008.
However, it did pick the right day. Feb 27, 2008 is 70 days out from
today (Dec 19).
This Calendar object is a bit tricky....
Any help would be great.
Ryan