Brian Denheyer wrote:
What's the best way to get the year/month/day/hour/min/sec of the
current time ?
import Data.Time
...
now - getCurrentTime
tz - getCurrentTimeZone
let t = utcToLocalTime tz now
(year, month, day) = toGregorian $ localDay t
TimeOfDay hour minute sec =
Hi All,
What's the best way to get the year/month/day/hour/min/sec of the
current time ? I've become mired in confusion with Time, Data.Time,
DateTime and I think there is even an old-time.
Might be a couple of calendar libraries in there, not quite sure...
Thanks,
Brian
'time' is the generally accepted package which exports the Data.Time you
mentioned. 'DateTime' looks to use 'time' to provide an aledgedly simpler
API. 'old-time' should go away eventually and thus you should not use it for
new projects.
You likely want 'getCurrentTime' [1].
Thomas
[1]