The next transition is in Autumn/Fall when clocks go back. I presume that the hour 01:00 to 02:00 is repeated in your area.
The nextTransition() method returns the time just after the transition. 02:00 (summer) never happens, so the method returns 01:00 (winter). The previousTransition() method returns the last millisecond before the transition. Remember that in Spring, 02:00 never happens during the DST gap, so the method cannot return 02:00. To print the transition time, use previousTransition(), convert it to a LocalDateTime, then add one millisecond. Stephen On 1 June 2011 15:13, java.peri...@gmail.com <java.peri...@gmail.com> wrote: > > Given the following code using a US/Eastern timzone: > > final DateTimeFormatter format = DateTimeFormat.mediumDateTime(); > final DateTimeZone tz = DateTimeZone.forID("US/Eastern"); > final long currentDateInMillis = System.currentTimeMillis(); > > final DateTime firstTransition = new > DateTime(tz.nextTransition(currentDateInMillis), tz); > final DateTime secondTransition = new > DateTime(tz.previousTransition(currentDateInMillis), tz); > > System.out.println("First Transition: " + > format.print(firstTransition)); > System.out.println("Second Transition: " + > format.print(secondTransition)); > > > Can someone explain to me why I get the following for output: > > First Transition: Nov 6, 2011 1:00:00 AM > Second Transition: Mar 13, 2011 1:59:59 AM > > > The transitions for US/Eastern timezones occur at 2 AM so why am I > seeing 1:00 AM and 1:59:59 AM? > > > ------------------------------------------------------------------------------ > Simplify data backup and recovery for your virtual environment with vRanger. > Installation's a snap, and flexible recovery options mean your data is safe, > secure and there when you need it. Data protection magic? > Nope - It's vRanger. Get your free trial download today. > http://p.sf.net/sfu/quest-sfdev2dev > _______________________________________________ > Joda-interest mailing list > Joda-interest@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/joda-interest > ------------------------------------------------------------------------------ Simplify data backup and recovery for your virtual environment with vRanger. Installation's a snap, and flexible recovery options mean your data is safe, secure and there when you need it. Data protection magic? Nope - It's vRanger. Get your free trial download today. http://p.sf.net/sfu/quest-sfdev2dev _______________________________________________ Joda-interest mailing list Joda-interest@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/joda-interest