Mojo::Date(3)
π Mojo::Date(3) β NAME π
okay bestie, this is the Mojo::Date(3) manual page from the User Contributed Perl Documentation β the HTTP date one. Periodt.
Mojo::Date β HTTP date. π
β¨ SYNOPSIS β¨
Quick vibe check β here's how you parse and build, no cap:
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 + 60);
say "$date";
π¦ DESCRIPTION π¦
Mojo::Date implements HTTP date and time functions, based on RFC 7230 (<https://tools.ietf.org/html/rfc7230>), RFC 7231 (<https://tools.ietf.org/html/rfc7231>) and RFC 3339 (<https://tools.ietf.org/html/rfc3339>). It's giving date-and-time main character energy, fr fr. π¦
πΈ ATTRIBUTES πΈ
Mojo::Date implements the following attributes. Let's go, bestie:
π°οΈ epoch
my $epoch = $date->epoch;
$date = $date->epoch(784111777);
Epoch seconds, defaults to the current time. Lowkey essential. β¨
π METHODS π
Mojo::Date inherits all methods from Mojo::Base and implements the following new ones. Slay.
π new
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. New object, who dis? π
π₯ parse
$date = $date->parse('Sun Nov 6 08:49:37 1994');
Parse date. Here's the whole snack buffet of formats it handles, iykyk:
# Epoch
say Mojo::Date->new('784111777')->epoch;
say Mojo::Date->new('784111777.21')->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;
# RFC 3339
say Mojo::Date->new('1994-11-06T08:49:37Z')->epoch;
say Mojo::Date->new('1994-11-06T08:49:37')->epoch;
say Mojo::Date->new('1994-11-06T08:49:37.21Z')->epoch;
say Mojo::Date->new('1994-11-06T08:49:37+01:00')->epoch;
say Mojo::Date->new('1994-11-06T08:49:37-01:00')->epoch;
π to_datetime
my $str = $date->to_datetime;
Render RFC 3339 (<https://tools.ietf.org/html/rfc3339>) date and time. Iconic output, honestly:
# "1994-11-06T08:49:37Z"
Mojo::Date->new(784111777)->to_datetime;
# "1994-11-06T08:49:37.21Z"
Mojo::Date->new(784111777.21)->to_datetime;
π to_string
my $str = $date->to_string;
Render date suitable for HTTP messages. This is the one that's ready for the group chat:
# "Sun, 06 Nov 1994 08:49:37 GMT"
Mojo::Date->new(784111777)->to_string;
π OPERATORS π
Mojo::Date overloads the following operators. Operator magic, bestie:
β bool
my $bool = !!$date;
Always true. No cap. π―
π stringify
my $str = "$date";
Alias for to_string. Obsessed. π
π«Ά SEE ALSO π«Ά
Mojolicious, Mojolicious::Guides, <https://mojolicious.org>.
That's the whole page, bestie! This was Mojo::Date(3) from perl v5.42.0, dated 2026-07-15. Catch you in the group chat β mwah πβ¨
π¦ where this page comes from
- opensuse-leap 16.0: perl-Mojolicious 9.480.0-bp160.2.1 Β· Artistic-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms