db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bernt M. Johnsen" <Bernt.John...@Sun.COM>
Subject Re: time format (or: the curse of dst)
Date Sat, 24 Oct 2009 14:28:15 GMT
>>>>>>>>>>>> Fabio wrote (2009-10-24 11:12:48):
> Hello,
>
> I'm using Apache Derby to store hourly values of electricity  
> consumption. The values are used in an electricity market simulation  
> implemented in Java.
>
> Now because of DST, hourly values mean that (for central Europe):
> - one day in March has 23 hours (there's no 2 a.m. to 3 a.m. during that 
> night)
> - one day in October has 25 hours (2 a.m. to 3 a.m. appears twice during 
> that night)
>
> The data in October is published as:
> (..)
> 02:00
> 3A:00
> 3B:00
> 04:00
> 05:00
> (..)
>
> I have yet to find a good solution on how to store this data in the  
> database. Obviously, "3A:00" is not a valid time format.
> Currently, I'm storing the consumption data in conjunction with a field 
> named "hour_in_year" (1-8760) but having the date and time is more handy 
> for sql select queries.
>
> Any ideas how to support the "curse of dst" in a time field?

The obvious solution is to store dates and times as UTC in your
databases, and handle time zones dst in your application. I don't know
the nature of your application, but if you implement special treatmet
of 3A:00 and 3B:00 it is still of no use if your application is to be
run in some Brazilian locale where the change to and from dst happens
at 00:00/01:00 instead of 02:00/03:00 as in most countries.

Bernt

>
> Fabio

Mime
View raw message