Mojo::Date - HTTP date
use Mojo::Date; # Parse my $date = Mojo::Date->new('Sun, 06 Nov 1994 08:49:37 GMT'); say $date->epoch; # Build my $date = Mojo::Date->new(time); say "$date";
Mojo::Date implements HTTP date and time functions based on RFC 7230 and RFC 7231.
Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123 Sunday, 06-Nov-94 08:49:37 GMT ; RFC 850, obsoleted by RFC 1036 Sun Nov 6 08:49:37 1994 ; ANSI C's asctime() format
Mojo::Date implements the following attributes.
my $epoch = $date->epoch; $date = $date->epoch(784111777);
Epoch seconds.
Mojo::Date inherits all methods from Mojo::Base and implements the following new ones.
my $date = Mojo::Date->new; my $date = Mojo::Date->new('Sun Nov 6 08:49:37 1994');
Construct a new Mojo::Date object and "parse" date if necessary.
$date = $date->parse('Sun Nov 6 08:49:37 1994');
Parse date.
# Epoch say Mojo::Date->new('784111777')->epoch; # RFC 822/1123 say Mojo::Date->new('Sun, 06 Nov 1994 08:49:37 GMT')->epoch; # RFC 850/1036 say Mojo::Date->new('Sunday, 06-Nov-94 08:49:37 GMT')->epoch; # Ansi C asctime() say Mojo::Date->new('Sun Nov 6 08:49:37 1994')->epoch;
my $str = $date->to_string;
Render date suitable for HTTP messages.
Mojo::Date overloads the following operators.
my $bool = !!$date;
Always true.
my $str = "$date";
Alias for "to_string".
Mojolicious, Mojolicious::Guides, http://mojolicio.us.
To install Mojolicious, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mojolicious
CPAN shell
perl -MCPAN -e shell install Mojolicious
For more information on module installation, please visit the detailed CPAN module installation guide.