[Haskell-beginners] Haskell and TimeZones

Brent Yorgey byorgey at seas.upenn.edu
Tue Jan 3 17:30:46 CET 2012


On Tue, Jan 03, 2012 at 01:04:20PM -0200, Thiago Negri wrote:
> Hi,
> 
> How does Haskell handle TimeZone?
> Do I need to use Oslon to have a historical database of TimeZones in Haskell?
> 
> I tried reading the package description and everything, but it seems
> complicated.
> Is there any easy to follow tutorial available?
> 
> For example, here in Brazil the daylight savings rules change every
> year. How do I update the Haskell Data.Time.* packages to know of the
> new rules? Or does it uses the TimeZone database from O.S.?
> 
> I'm looking for a solution that works in any platform (mac, linux,
> windows).

Hi Thiago,

The time package by itself does not know about changing time zone
rules.  However, the timezone-series package
(http://hackage.haskell.org/package/timezone-series) claims to extend
Data.Time with exactly that capability.  You can use it in conjunction
with the timezon-olson package
(http://hackage.haskell.org/package/timezone-olson) for reading Olson
timezone databases.  (Disclaimer: I have never used these packages
myself.)  

It would be really great if someone wrote an easy to follow tutorial
for dealing with time in Haskell, but as far as I know no one has yet
done so.  The time package is indeed complicated, but unfortunately
that's because representing time is a complicated subject.  Any
simpler and it would be wrong.

-Brent



More information about the Beginners mailing list