WARC::Date - datestamp objects for WARC library
use WARC::Date; $datestamp = WARC::Date->now(); # construct from current time $datestamp = WARC::Date->from_epoch(time); # likewise $datestamp = WARC::Date->from_string($string);# construct from string $time = $datestamp->as_epoch; # as seconds since epoch $text = $datestamp->as_string; # as "YYYY-MM-DDThh:mm:ssZ"
WARC::Date objects encapsulate the details of the required format for timestamps in WARC headers.
WARC::Date
These objects have overloaded string and number conversions. As a string, a WARC::Date object produces the [W3C-NOTE-datetime] format, while conversion to a number yields an epoch timestamp.
Construct a WARC::Date object representing the current time.
Construct a WARC::Date object representing the time indicated by an epoch timestamp.
Construct a WARC::Date object representing the time indicated by a string in the same format returned by the as_string method.
as_string
Return the represented time as an epoch timestamp.
Return a string in the format specified by [W3C-NOTE-datetime] restricted to 14 digits and UTC time zone, which is "YYYY-MM-DDThh:mm:ssZ".
Conversion to epoch time is limited by the range of Time::Local.
Time::Local
Jacob Bachmeyer, <jcb@cpan.org>
WARC, HTTP::Date, Time::Local
[W3C-NOTE-datetime] "Date and Time Formats" http://www.w3.org/TR/NOTE-datetime.
Copyright (C) 2019 by Jacob Bachmeyer
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install WARC, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WARC
CPAN shell
perl -MCPAN -e shell install WARC
For more information on module installation, please visit the detailed CPAN module installation guide.