ISO8601
- Class for handling conversions to/from unixtime and ISO8601 datetime
use ISO8601;
# convert without instantiating
my $dtstring=time2iso(time());
my $unixtime=iso2time($dtstring);
A collection of functions to handle the conversion to and from unixtime and iso8601-time.
This class does not have an instantiator/constructor. The two methods are exported by default and can be used at any time.
Converts from unixtime to ISO8601-time
Accepts these parameters in the following order:
unixtime The unixtime to be converted. SCALAR. Required.
format Format options to the conversion process. HASH-reference. Optional. Accepted keys in the HASH- reference are: second, minute, hour, date and basic. All of the option keys are boolean and if evaluated to true will give: second (all time, including seconds), minute (all time down to and including minute), hour (only hour time), date (only give date), basic (only give basic time).
Returns an ISO-string at the end of the conversion.
Converts an ISO string to unix datetime.
Only accepts one parameter: isotime. SCALAR. Required.
The ISO time string is given to the method and it converts it to iso.
Return the unixtime to the user.