My time zone is CET (Berlin).
And while testing Joda's DateTime i noticed some strange things:
new DateTime(1893, 4, 1, 0, 0, 0, 0);
=> java.lang.IllegalArgumentException: Illegal instant due to time zone offset transition:
new DateTime(1893, 3, 31, 0, 0, 0, 0).toDate();
=> Fri Mar 31 00:06:32 CET 1893
A 6 minute 32 seconds shift in the time zone resulting in a non-existent time??
I must say this is highly unexpected since i didn't specify any time zone info and thus didn't expect to run into this kind of problem.
If in March of 1893 CET (Berlin) doesn't exist - why doesn't new DateTime(1893, 3, 31, 0, 0, 0, 0)
pick the time zone that matches the time i specified (i.e. 0 minutes and 0 seconds)?
What are my options to get the correct time with DateTime?
-- EDIT --
The problem seems to be the toDate(). I had edited it out before posting the question.
Joda itself actually works fine:
new DateTime(1893, 3, 31, 0, 0, 0, 0);
=> 1893-01-01T00:00:00.000+00:53:28
It's just that the conversion to Date moves part of the offset into the minutes and seconds.