Calculating DST duplicate hour

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

Calculating DST duplicate hour

Tom Nichols
Hi everyone, hoping someone can help me out with a DST issue...

I'm working with a third party service that tracks hourly market
prices for a commodity.  Unfortunately the service uses "Eastern
Prevailing Time," i.e. EST or EDT (whichever is in effect).  I get
data as a Date (accurate to the day), an "hour ending," and a "is
duplicate hour" flag - which indicates whether this is the 'first' 2am
or the second on the DST transition day.  Fun, right?

So I'm trying to figure out how to convert this into UTC.  I can
initialize a DateTime instance accurate to the day, with the current
timezone in effect, but if I call withHourOfDay(2) on the Fall DST
changeover day, is that the first hour or the second?

I almost thought I would be better off always using EST, _add_ the
hour to (date at midnight), and add 1 if DST is in effect.  But I have
exceptions if it is the DST changeover day and the hour is 1...  Any
thoughts?

Thanks in advance.
-Tom

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
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: Calculating DST duplicate hour

P. Hill & E. Goodall
Tom Nichols wrote:
> Hi everyone, hoping someone can help me out with a DST issue...
>
> I'm working with a third party service that tracks hourly market
> prices for a commodity.  Unfortunately the service uses "Eastern
> Prevailing Time," i.e. EST or EDT (whichever is in effect).

I think that usually the thing which includes both EST & EDT  is
(unofficially, since there is no official name for it) called "Eastern
Time".

> I get
> data as a Date (accurate to the day), an "hour ending," and a "is
> duplicate hour" flag - which indicates whether this is the 'first' 2am
> or the second on the DST transition day.  Fun, right?

You might try adding 1 hour to the 2AM when you see the flag
and hopefully you'll be able to see it go from 2 EDT to 2 EST
or Hour of Day 2 to Hour of Day 3.

> So I'm trying to figure out how to convert this into UTC.  I can
> initialize a DateTime instance accurate to the day, with the current
> timezone in effect, but if I call withHourOfDay(2) on the Fall DST
> changeover day, is that the first hour or the second?

I believe HOUR of DAY should be 1,2,3,4,5,6,7,8,...24,25 on the Fall
back date.

-Paul

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
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: Calculating DST duplicate hour

Tom Nichols
Wonderful.  Thank you Paul.

On Mon, Sep 15, 2008 at 12:48 AM, P.Hill & E. Goodall
<[hidden email]> wrote:

> Tom Nichols wrote:
>> Hi everyone, hoping someone can help me out with a DST issue...
>>
>> I'm working with a third party service that tracks hourly market
>> prices for a commodity.  Unfortunately the service uses "Eastern
>> Prevailing Time," i.e. EST or EDT (whichever is in effect).
>
> I think that usually the thing which includes both EST & EDT  is
> (unofficially, since there is no official name for it) called "Eastern
> Time".
>
>> I get
>> data as a Date (accurate to the day), an "hour ending," and a "is
>> duplicate hour" flag - which indicates whether this is the 'first' 2am
>> or the second on the DST transition day.  Fun, right?
>
> You might try adding 1 hour to the 2AM when you see the flag
> and hopefully you'll be able to see it go from 2 EDT to 2 EST
> or Hour of Day 2 to Hour of Day 3.
>
>> So I'm trying to figure out how to convert this into UTC.  I can
>> initialize a DateTime instance accurate to the day, with the current
>> timezone in effect, but if I call withHourOfDay(2) on the Fall DST
>> changeover day, is that the first hour or the second?
>
> I believe HOUR of DAY should be 1,2,3,4,5,6,7,8,...24,25 on the Fall
> back date.
>
> -Paul
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Joda-interest mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/joda-interest
>

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
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: Calculating DST duplicate hour

jodastephen
>> I believe HOUR of DAY should be 1,2,3,4,5,6,7,8,...24,25 on the Fall
>> back date.

The hour of day field still runs from 0 to 23, even on the DST cutover
day, with the repeated hour number occurring twice.

JSR-310 will have better solutions for this problem.

Stephen

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Joda-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/joda-interest
Loading...