On 24 February 2012 09:08, Mei Chan <mchan...@yahoo.com> wrote: > My daylight savings calculation using Joda seems to be off by hour and was > wondering if someone could enlighten me on what the issue may be. I'm using > joda version 2.0 > > Date newDate = new > DateTime(System.currentTimeMillis()).plusWeeks(12).toDate(); > > I would of expected something like the following the newly calculated date > to be (taking in account that we would be in daylight savings) > Tue May 22 01:49:16 PDT 2012 > > However, I get the following instead which seems to be off by an hour. > Tue May 22 00:49:16 PDT 2012
Any time that you convert from a Joda-Time object to a java.util.Date you add uncertainty. j.u.Date uses the JDK time-zone data, whereas Joda-Time has its own separate data. Also, j.u.Date always prints the time in the default time zone. Try printing out the results of - DateTimeZone.getDefault() - TimeZone.getDefault() - the DateTime you create - the value of getZone() on the DateTime Somewhere there will be a difference. Stephen ------------------------------------------------------------------------------ Virtualization & Cloud Management Using Capacity Planning Cloud computing makes use of virtualization - but cloud computing also focuses on allowing computing to be delivered as a service. http://www.accelacomm.com/jaw/sfnl/114/51521223/ _______________________________________________ Joda-interest mailing list Joda-interest@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/joda-interest