Joda-Time by default uses an ISO chronology, which is a proleptic gregorian
calendar. Java's Date class uses a gregorian/julian calendar which has a gap
of several days to account for the error between the two. If you want the
two representations to be the same, you need to use Joda-Time's
GJChronology.
Other differences are caused by how the time zone rules are implemented.
Joda-Time strictly follows the tz database rules, which is why you see
differences before 1884.
If you want to support historical datetimes in a consistent fashion, the
easiest thing is to not switch between Joda-Time and Java Date.
On Mon, Nov 10, 2008 at 4:36 PM, Andreas Guther <
[EMAIL PROTECTED]> wrote:
> Hi,
>
>
>
> I noticed a converting problem from DateTime to java.util.Date. Dates in
> the past seem to be off by one or more days, depending on how far those
> dates are in the past. My observation is, that dates until 1884 are fine,
> but before are starting to be off by one day. Is there something I have to
> configure. It is hard to believe that this is a bug.
>
>
>
> public static void main(String[] args) {
>
> DateTimeFormatter fmt = DateTimeFormat.forPattern("MM/dd/yyyy");
>
> DateTime dateTime = fmt.parseDateTime("10/11/1492");
>
> System.out.println(dateTime);
>
> // prints 1492-10-11T00:00:00.000-07:52:58 – AS EXPECTED
>
> System.out.println(dateTime.toDate());
>
> // prints Mon Oct 01 23:52:58 PST 1492 – MONTH OK, BUT DAY WAY
> OFF!!!!
>
> }
>
>
>
> We are currently using joda-time 1.5.2.
>
>
>
>
>
> Andreas
>
>
>
>
>
> -------------------------------------------------------------------------
> 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
>
>
-------------------------------------------------------------------------
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