Haskell Convert Byte String To UTC Time
- by Steve
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 }