
I want to calculate the length of time between time ta and time tb. Time ta is a String looking like "N:NNAM" or "N:NNPM." I need tb to be 9:30AM on the current date. I think the flow should be 1) parse ta to utcTimeA :: UTCTime 2) get current date and form tb to utcTimeB :: UTCTime 3) call "diffUTCTime utcTimeA utcTimeB" So my program looks like as follows in a "do" expression: let utcTimeA = fromJust (parseTime defaultTimeLocale "%R%P" ta :: Maybe UTCTime) currentTime <- getCurrentTime let day = utctDay currentTime let utcTimeB = UTCTime day "09:30:00.0000000 UTC" let timeElapsed = diffUTCTime utcTimeA utcTimeB There are two difficulties I could not get around: 1) It seems that parseTime returns "Nothing". Why? 2) I knew "09:30:00.0000000 UTC" in the statement of "let utcTimeB ..." is incorrect, because it is a String instead of expected DiffTime type. After consulting Data.Time module (it just say "Data DiffTime"), I still cannot figure out how to get utcTimeB. Can someone help me? Thanks, Hong