Fall DST repeating hour off by an hour

classic Classic list List threaded Threaded
4 messages Options
Dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Fall DST repeating hour off by an hour

Dev
Hi -

I am trying work on a simple solution that will return
complete hours of the day including timezone offset.
Following is the code that is being used to spit
out each hour: -


DateTimeFormatter fmt =
DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ssZZ");

//Setting 2011 Fall DST day.
DateTime st = new DateTime(2011, 11, 6, 0, 0,
              DateTimeZone.forID("America/Chicago"));

DateTime et = new DateTime(2011, 11, 6, 0, 0,
          DateTimeZone.forID("America/Chicago"));
//======================================
for (int i = 0; i <= 24; i++) {
     try {
            if (i > 0) {
                 st = st.minuteOfDay().addToCopy(60);
            }
            et = et.minuteOfDay().addToCopy(60);
     
           System.out.println("START TIME = { "
           + fmt.print(st)
           + " } END TIME =  {"
           + fmt.print(et) + " }");
     } catch (Exception e) {
        e.printStackTrace();
     }
}
//=====================================

Above logic spit out the all the correct
(as per our expectation) hours and time offsets
 for all days of the year but the fall DST. For the
fall DST of 2011, which in Nov 06, we are expecting the
following intervals(hour start -- hour end): -

1st interval
----------------
START TIME = { 2011-11-06T00:00:00-05:00 }
END TIME =  {2011-11-06T01:00:00-05:00 }

2nd interval
----------------
START TIME = { 2011-11-06T01:00:00-05:00 }
END TIME =  {2011-11-06T02:00:00-05:00 }

3rd interval
----------------
START TIME = { 2011-11-06T02:00:00-05:00 }
END TIME =  {2011-11-06T02:00:00-06:00 }

4th interval
----------------
START TIME = { 2011-11-06T02:00:00-06:00 }
END TIME =  {2011-11-06T03:00:00-06:00 }

But the above code is returning the following result: -

1st interval
----------------
START TIME = { 2011-11-06T00:00:00-05:00 }
END TIME =  {2011-11-06T01:00:00-05:00 }

2nd interval
----------------
START TIME = { 2011-11-06T01:00:00-05:00 }
END TIME =  {2011-11-06T01:00:00-06:00 }

3rd interval
----------------
START TIME = { 2011-11-06T01:00:00-06:00 }
END TIME =  {2011-11-06T02:00:00-06:00 }


4th interval
----------------
START TIME = { 2011-11-06T02:00:00-06:00 }
END TIME =  {2011-11-06T03:00:00-06:00 }


Our problem is the second and third interval, as per
our expectation, we are expecting the second interval
as 01:00:00-05:00 to 02:00:00-5:00 and the third
interval as 02:00:00-5:00 to 02:00:00-6:00, instead of
the data being returned by the current code. I am
currently using 2.0RC1 implementation and I did
try going as far back as 1.5 with slight modifications
in the API the fall DST result is still the same.

Can someone help me on this? I did read somewhere
that in certain previous version the result would have
 been as we are expecting.Can someone point to that
version or provide details to get what we are expecting?


Best Regards-
Dev


------------------------------------------------------------------------------
AppSumo Presents a FREE Video for the SourceForge Community by Eric
Ries, the creator of the Lean Startup Methodology on "Lean Startup
Secrets Revealed." This video shows you how to validate your ideas,
optimize your ideas and identify your business strategy.
http://p.sf.net/sfu/appsumosfdev2dev
_______________________________________________
Joda-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/joda-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Fall DST repeating hour off by an hour

jodastephen
Are you using v1.6.2 or v2.0-RC1 ?
There are differences in handling around DST changes between the two.
Stephen

On 15 July 2011 22:08, Dev <[hidden email]> wrote:

> Hi -
>
> I am trying work on a simple solution that will return
> complete hours of the day including timezone offset.
> Following is the code that is being used to spit
> out each hour: -
>
>
> DateTimeFormatter fmt =
> DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ssZZ");
>
> //Setting 2011 Fall DST day.
> DateTime st = new DateTime(2011, 11, 6, 0, 0,
>              DateTimeZone.forID("America/Chicago"));
>
> DateTime et = new DateTime(2011, 11, 6, 0, 0,
>          DateTimeZone.forID("America/Chicago"));
> //======================================
> for (int i = 0; i <= 24; i++) {
>     try {
>            if (i > 0) {
>                 st = st.minuteOfDay().addToCopy(60);
>            }
>            et = et.minuteOfDay().addToCopy(60);
>
>           System.out.println("START TIME = { "
>           + fmt.print(st)
>           + " } END TIME =  {"
>           + fmt.print(et) + " }");
>     } catch (Exception e) {
>        e.printStackTrace();
>     }
> }
> //=====================================
>
> Above logic spit out the all the correct
> (as per our expectation) hours and time offsets
>  for all days of the year but the fall DST. For the
> fall DST of 2011, which in Nov 06, we are expecting the
> following intervals(hour start -- hour end): -
>
> 1st interval
> ----------------
> START TIME = { 2011-11-06T00:00:00-05:00 }
> END TIME =  {2011-11-06T01:00:00-05:00 }
>
> 2nd interval
> ----------------
> START TIME = { 2011-11-06T01:00:00-05:00 }
> END TIME =  {2011-11-06T02:00:00-05:00 }
>
> 3rd interval
> ----------------
> START TIME = { 2011-11-06T02:00:00-05:00 }
> END TIME =  {2011-11-06T02:00:00-06:00 }
>
> 4th interval
> ----------------
> START TIME = { 2011-11-06T02:00:00-06:00 }
> END TIME =  {2011-11-06T03:00:00-06:00 }
>
> But the above code is returning the following result: -
>
> 1st interval
> ----------------
> START TIME = { 2011-11-06T00:00:00-05:00 }
> END TIME =  {2011-11-06T01:00:00-05:00 }
>
> 2nd interval
> ----------------
> START TIME = { 2011-11-06T01:00:00-05:00 }
> END TIME =  {2011-11-06T01:00:00-06:00 }
>
> 3rd interval
> ----------------
> START TIME = { 2011-11-06T01:00:00-06:00 }
> END TIME =  {2011-11-06T02:00:00-06:00 }
>
>
> 4th interval
> ----------------
> START TIME = { 2011-11-06T02:00:00-06:00 }
> END TIME =  {2011-11-06T03:00:00-06:00 }
>
>
> Our problem is the second and third interval, as per
> our expectation, we are expecting the second interval
> as 01:00:00-05:00 to 02:00:00-5:00 and the third
> interval as 02:00:00-5:00 to 02:00:00-6:00, instead of
> the data being returned by the current code. I am
> currently using 2.0RC1 implementation and I did
> try going as far back as 1.5 with slight modifications
> in the API the fall DST result is still the same.
>
> Can someone help me on this? I did read somewhere
> that in certain previous version the result would have
>  been as we are expecting.Can someone point to that
> version or provide details to get what we are expecting?
>
>
> Best Regards-
> Dev
>
>
> ------------------------------------------------------------------------------
> AppSumo Presents a FREE Video for the SourceForge Community by Eric
> Ries, the creator of the Lean Startup Methodology on "Lean Startup
> Secrets Revealed." This video shows you how to validate your ideas,
> optimize your ideas and identify your business strategy.
> http://p.sf.net/sfu/appsumosfdev2dev
> _______________________________________________
> Joda-interest mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/joda-interest
>

------------------------------------------------------------------------------
AppSumo Presents a FREE Video for the SourceForge Community by Eric
Ries, the creator of the Lean Startup Methodology on "Lean Startup
Secrets Revealed." This video shows you how to validate your ideas,
optimize your ideas and identify your business strategy.
http://p.sf.net/sfu/appsumosfdev2dev
_______________________________________________
Joda-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/joda-interest
Dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Fall DST repeating hour off by an hour

Dev
Hi -

I used both the versions (joda-time-1.6.2.jar
and joda-time-2.0-RC1.jar) and used the following API:-

DateTime st = new DateTime(
2011, 11, 6,0,0,0,0, DateTimeZone.forID("America/Chicago"));

and the results they returned were identical.

START TIME = { 2011-11-06T00:00:00-05:00 }
END TIME =  {2011-11-06T01:00:00-05:00 }

START TIME = { 2011-11-06T01:00:00-05:00 }
END TIME =  {2011-11-06T01:00:00-06:00 }

START TIME = { 2011-11-06T01:00:00-06:00 }
END TIME =  {2011-11-06T02:00:00-06:00 }

Any suggestions? As stated in my previous email, for fall DST
I want the hour ceiling, i.e. 01:00 -5 to 02:00 -5 and then
02:00 -5 to 02:00 -6.

Best Regards-
Dev




------------------------------------------------------------------------------
AppSumo Presents a FREE Video for the SourceForge Community by Eric
Ries, the creator of the Lean Startup Methodology on "Lean Startup
Secrets Revealed." This video shows you how to validate your ideas,
optimize your ideas and identify your business strategy.
http://p.sf.net/sfu/appsumosfdev2dev
_______________________________________________
Joda-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/joda-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Fall DST repeating hour off by an hour

jodastephen
HI,
It looks to me like Joda-Time is working correctly.

According to this
http://www.timeanddate.com/worldclock/clockchange.html?n=64
DST in Chicago changes at 2am back to 1am, thus the hour from 1am to
2am occurs twice.

The time 02:00 does not occur at offset -05:00, thus Joda-Time cannot
return it, whereas 01:00 occurs twice at offsets -05:00 and -06:00.

To return a time of 02:00-05:00 is up to you - Joda-Time doesn't help
much directly with invalid times!

All I can think you can do is to use DateTimeZone.nextTransiton() to
determine if a transition has occurred and then to print a different
textual string. No Joda-Time object can hold the representation you
want, but a string can.

Stephen



On 18 July 2011 15:53, Dev <[hidden email]> wrote:

> Hi -
>
> I used both the versions (joda-time-1.6.2.jar
> and joda-time-2.0-RC1.jar) and used the following API:-
>
> DateTime st = new DateTime(
> 2011, 11, 6,0,0,0,0, DateTimeZone.forID("America/Chicago"));
>
> and the results they returned were identical.
>
> START TIME = { 2011-11-06T00:00:00-05:00 }
> END TIME =  {2011-11-06T01:00:00-05:00 }
>
> START TIME = { 2011-11-06T01:00:00-05:00 }
> END TIME =  {2011-11-06T01:00:00-06:00 }
>
> START TIME = { 2011-11-06T01:00:00-06:00 }
> END TIME =  {2011-11-06T02:00:00-06:00 }
>
> Any suggestions? As stated in my previous email, for fall DST
> I want the hour ceiling, i.e. 01:00 -5 to 02:00 -5 and then
> 02:00 -5 to 02:00 -6.
>
> Best Regards-
> Dev
>
>
>
>
> ------------------------------------------------------------------------------
> AppSumo Presents a FREE Video for the SourceForge Community by Eric
> Ries, the creator of the Lean Startup Methodology on "Lean Startup
> Secrets Revealed." This video shows you how to validate your ideas,
> optimize your ideas and identify your business strategy.
> http://p.sf.net/sfu/appsumosfdev2dev
> _______________________________________________
> Joda-interest mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/joda-interest
>

------------------------------------------------------------------------------
Storage Efficiency Calculator
This modeling tool is based on patent-pending intellectual property that
has been used successfully in hundreds of IBM storage optimization engage-
ments, worldwide.  Store less, Store more with what you own, Move data to
the right place. Try It Now! http://www.accelacomm.com/jaw/sfnl/114/51427378/
_______________________________________________
Joda-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/joda-interest
Loading...