[Haskell-cafe] Fwd: Data.Time

Joey Hess joey at kitenet.net
Sun Jul 3 00:03:44 CEST 2011


Yitzchak Gale wrote:
> The API for parsing and rendering time in Data.Time is
> based on the standard API for that in C - like the libraries
> in most languages. It's pretty standard stuff.
> 
> I'm sure it can be improved upon though. If you have a useful
> alternative time parsing library, please release it on Hackage.

In the perl world, there is a Date::Parse library that I have
found very useful in many situations. It can parse any date format
you throw at it, fairly reliably[1].

The closest I have in Haskell is the attached module, which I used to parse
all dates in all Usenet posts between 1981 and 1991. While small portions
are specific to Usenet messages it does have quite a lot of generic
parsing code, and perhaps most usefully, a large number of date format
strings, and I have thought about making a library if I find time.
(Or anyone is welcome to take it and do so.)

It's based on Data.Time.Parse instead of Data.Time.Format.parseTime,
probably because I didn't notice the latter when I was writing it.

-- 
see shy jo

[1] m/d/y vs d/m/y being the main weakness of course
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MsgTime.hs
Type: text/x-haskell
Size: 7858 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110702/442f77f8/attachment.hs>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 828 bytes
Desc: Digital signature
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110702/442f77f8/attachment.pgp>


More information about the Haskell-Cafe mailing list