Reputation: 5149
I am currently using the code below in a projectdate :: IO (Integer,Int,Int) -- :: (year,month,day)
date = getCurrentTime >>= return . toGregorian . utctDay
However it does not give the correct local date when run. I have run this at 1am on the 26/04/11 yet the function results in (2011, 4, 25)
.
I understand that the utctDay
refers to UTC and therefore isn't the local system date, but is it possible to get the same format of date as seen above but with the correct date depending on the machines system date?
Upvotes: 6
Views: 2715
Reputation: 38893
Try getZonedTime: http://hackage.haskell.org/packages/archive/time/1.2.0.4/doc/html/Data-Time-LocalTime.html#v:getZonedTime
Upvotes: 10