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?
Try getZonedTime: http://hackage.haskell.org/packages/archive/time/1.2.0.4/doc/html/Data-Time-LocalTime.html#v:getZonedTime
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With