haskellhaskell-time

How do I create a UTCTime value using the time library in Haskell?


I've got a year, month, day, hour and minute value (all of them are of type Int) - how can I convert these to a UTCTime?

Just as How do I create a UTCTime from Int values, using the thyme library in Haskell? but using the time library instead.


Solution

  • import Data.Time.Calendar
    import Data.Time
    
    example :: UTCTime
    example = UTCTime (fromGregorian 2018 10 27) (secondsToDiffTime 0)