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

Dmitri O.Kondratiev dokondr at gmail.com
Tue Jun 14 23:32:30 CEST 2011


Magnifique, ca marche!  Grand merci, Vincent!

On Wed, Jun 15, 2011 at 1:16 AM, Vincent Gerard <vincent at xenbox.fr> wrote:

> Hello Dmitri,
>
> It seems that your format pattern does not match exactly the format of
> the input, thus the parser returns Nothing.
>
> Try the following format string which seems to work with your date:
>
> parseTime defaultTimeLocale "%m/%d/%Y %l:%M:%S %p" ds :: Maybe
> UTCTime returns : Just 2009-10-11 19:04:28 UTC
>
> The parsings errors in your format could come from
>  .  %D expects a 2 char year
>  .  %H expects a 0 padded hour (like 07, not 7)
>
> Regards,
>
> Vincent Gerard
>
> On Wed, 15 Jun 2011 00:33:56 +0400
> "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?
> >
> > Thanks !
> > Dmitri.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110615/519160c1/attachment.htm>


More information about the Haskell-Cafe mailing list