Task

Given the date string "March 7 2009 7:30pm EST", 

output the time 12 hours later in any human-readable format.

As extra credit, display the resulting time in a time zone different from your own.




import qualified Data.Time.Clock.POSIX as P
import qualified Data.Time.Format as F
 
-- UTC from EST
main :: IO ()
main = print t2
  where
    t1 =
      F.parseTimeOrError
        True
        F.defaultTimeLocale
        "%B %e %Y %l:%M%P %Z"
        "March 7 2009 7:30pm EST"
    t2 = P.posixSecondsToUTCTime $ 12 * 60 * 60 + P.utcTimeToPOSIXSeconds t1