I have a date in string format like "MM/dd/YYYY" and I need to get a
date in string format that is six months later.
So here is my method:
String dateStr = "03/12/2010"
// Create a java.util.Date from dateStr
java.util.Date date = format.parse(dateStr);
DateTime dateTime = new DateTime(date); // get a DateTime object
DateTime sixMonthsLater = dateTime.plusMonths(6);
sixMonthsLaterStr = sixMonthsLater.getMonthOfYear() + "/" +
sixMonthsLater.getDayOfWeek() + "/" + sixMonthsLater.getYear();
return sixMonthsLaterStr;
When this run, I get a date back of (for sixMonthsLaterStr) as
"9/7/2010" or September 7th, 2010 (I expected September 12th, 2010)
so it is not quite six months later. I would expect 3/12/2010 six
months later would be 9/12/2010.
can this bug be fixed?
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Joda-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/joda-interest