Haskell Convert Byte String To UTC Time

Posted by Steve on Stack Overflow See other posts from Stack Overflow or by Steve
Published on 2010-05-02T00:44:57Z Indexed on 2010/05/02 0:47 UTC
Read the original article Hit count: 631

Filed under:
|

I have been trying to make a function in Haskell to take a ByteString which is a datetime and convert it to UTC time taking into account the time zone from the original encoding. I am very new to Haskell so I may be making a really basic mistake.

convertStringToUtc s =
  do
    estTimeZone <- hoursToTimeZone -5
    time <- read $ B.unpack(s)
    localTimeToUTC estTimeZone time

The error I get is:

Couldn't match expected type `Int -> b'
       against inferred type `UTCTime'
In the expression: localTimeToUTC estTimeZone time
In the expression:
    do { estTimeZone <- hoursToTimeZone - 5;
         time <- read $ B.unpack (s);
         localTimeToUTC estTimeZone time }

© Stack Overflow or respective owner

Related posts about haskell

Related posts about time