[Haskell-cafe] Please help : Data.Time.Format parseTime

Henk-Jan van Tuyl hjgtuyl at chello.nl
Tue Jun 14 23:05:02 CEST 2011


On Tue, 14 Jun 2011 22:33:56 +0200, Dmitri O.Kondratiev  
<dokondr at gmail.com> wrote:

> I am trying to convert data string to time:
>
> import Data.Time
> import Data.Time.Format
> import Locale
>
> ds = "10/11/2009 7:04:28 PM"
> t = parseTime defaultTimeLocale "%D %H:%M:%S  %p" ds :: Maybe UTCTime
>
> and get "Nothing".
> What is wrong?

According to the documentation[0], %D expects a two digit year.

Regards,
Henk-Jan van Tuyl

[0]  
http://hackage.haskell.org/packages/archive/time/latest/doc/html/Data-Time-Format.html#v:formatTime


-- 
http://Van.Tuyl.eu/
http://members.chello.nl/hjgtuyl/tourdemonad.html
--



More information about the Haskell-Cafe mailing list