localtime
and gmtime
functions with implementations that return objects. It does so in a backwards compatible manner, so that using localtime/gmtime in the way documented in perlfunc will still return what you expect.localtime
and gmtime
are not listed above. If called as methods on a Time::Piece object, they act as constructors, returning a new Time::Piece object for the current time. In other words: they're not useful as methods.truncate
method returns a copy of the object but with the time truncated to the start of the supplied unit.$t
had previously. Allowed values for the 'to' parameter are: 'year', 'quarter', 'month', 'day', 'hour', 'minute' and 'second'.time()
function and supported by gmtime()
and localtime()
.2^31
seconds then this module is likely to fail at processing dates beyond the year 2038. There are moves afoot to fix that in perl. Alternatively use 64 bit perl. Or if none of those are options, use the DateTime module which has support for years well into the future and past.