You can print DateTimeZone.getDefault() to see what time zone JodaTime is using.
Stephen 2009/5/27 <e.mcgr...@imilia.com>: > I have a time zone problem and I'm using the following code to try and figure > out what's going on: > void test(){ > Calendar cal = Calendar.getInstance(); > logger.info("Time zone according to Calendar:" + > cal.getTimeZone().getID()); > > DateTime dateTime = > monthYearFormatter.parseDateTime("05.2009"); > > logger.info("Joda TimeZone is: " + dateTime.getZone().getID()); > > LocalDate start = > dateTime.toLocalDate().dayOfMonth().withMinimumValue(); > LocalDate end = start.plusMonths(1); > > Date d1 = start.toDateTimeAtStartOfDay().toDate(); > Date d2 = end.toDateTimeAtStartOfDay().toDate(); > > logger.info("d1 = " + d1.toLocaleString()); > logger.info("d2 = " + d2.toLocaleString()); > } > Running the code on the command line gives me correctly > Time zone according to Calendar:GMT+01:00 > Joda TimeZone is: +01:00 > d1 = 01.05.2009 00:00:00 > d2 = 01.06.2009 00:00:00 > > The exact same code running in Tomcat (5.5 also tested with 6.0) and on the > same machine as above (Tomcat has Europe/Berlin (CEST) as the time zone) > gives me > Time zone according to Calendar:Europe/Berlin > Joda TimeZone is: UTC > d1 = 01.05.2009 02:00:00 > d2 = 01.06.2009 02:00:00 > > Where is the UTC coming from? Is it because I'm parsing a date that doesn't > belong to any time zone? > > The problem is that I need to pass the java.util.Date instances on the jdbc > and the time part must be 00:00:00 in order for the query to work. > > ------------------------------------------------------------------------------ > Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT > is a gathering of tech-side developers & brand creativity professionals. Meet > the minds behind Google Creative Lab, Visual Complexity, Processing, & > iPhoneDevCamp as they present alongside digital heavyweights like Barbarian > Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com > _______________________________________________ > Joda-interest mailing list > Joda-interest@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/joda-interest > ------------------------------------------------------------------------------ Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT is a gathering of tech-side developers & brand creativity professionals. Meet the minds behind Google Creative Lab, Visual Complexity, Processing, & iPhoneDevCamp as they present alongside digital heavyweights like Barbarian Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com _______________________________________________ Joda-interest mailing list Joda-interest@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/joda-interest