On 17 April 2012 07:12, nino martinez wael <nino.martinez.w...@gmail.com> wrote: > @Test > public void testJoda(){ > DateTimeFormatter withPivotYear = > DateTimeFormat.forPattern("HH:mm").withLocale(new Locale("da_DK")); > Calendar instance = Calendar.getInstance(); > instance.set(1900, 0, 1, 0, 0,0); > Date dateModified=instance.getTime(); > DateTime dt = new DateTime(dateModified); > > String result=withPivotYear.print(dt); > Assert.assertTrue("00:00".equalsIgnoreCase(result)); > > } > the contents of dt becomesĀ 1899-12-31T23:09:21.857+00:09:21 thus the result > becomes 23:09, whats wrong?
Every time you mix JDK classes and Joda-Time classes, this FAQ applies http://joda-time.sourceforge.net/faq.html#wrongoffset In your case, the 1900 date is probably before when daylight savings started. For those dates, JodaTime uses LMT (Local Mean Time) when the JDK uses the current fixed offset. This difference account for your result. Stephen ------------------------------------------------------------------------------ Better than sec? Nothing is better than sec when it comes to monitoring Big Data applications. Try Boundary one-second resolution app monitoring today. Free. http://p.sf.net/sfu/Boundary-dev2dev _______________________________________________ Joda-interest mailing list Joda-interest@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/joda-interest