Hi,
Check the following code,
void printBirthday(int year, int month, int day, int offset) {
MutableDateTime birthday = new
MutableDateTime(DateTimeZone.forOffsetHours(offset));
SimpleDateFormat format = new SimpleDateFormat();
System.out.print("offset:" + offset + " " +
format.format(birthday.toDate()));
birthday.addYears(year - birthday.getYear());
birthday.addMonths(month - birthday.getMonthOfYear());
birthday.addDays(day - birthday.getDayOfMonth());
System.out.println(" date:" + format.format(birthday.toDateTime()));
}
when I invoke it like this, printBirthday(2008, 10, 20, 14); It prints...
offset:14 2008/10/21 2:40 PM date:10/20/08 2:40 PM
and when I invoke same date with offest 15... printBirthday(2008, 10, 20,
15); It prints...
offset:14 2008/10/21 2:40 PM date:10/20/08 2:40 PM
See how the joda converted day is "19th" for offset 15 while with offset 14
it is "20th" (with the time being the same)? Is this expected? I thought the
date should be 20th irrespective of the timezone (or at least the time
should be corrected).
Thanks,
Sachin
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Joda-interest mailing list
Joda-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/joda-interest