Atompu...ateTime(3pm)

๐Ÿ“ฆ
version 0.3.7 ยท 4 versions
, in ubuntu resolute, ubuntu stonking

โœจ NAME โœจ

Atompub::DateTime โ€” bestie, it's a date and time object for the Atom Publishing Protocol ๐Ÿ’–

(also hi, this is <pink>Atompub::DateTime(3pm)</pink> from the User Contributed Perl Documentation, aka the perl fam's corner of the manual โ€” pull up a chair ๐Ÿซถ)


๐Ÿฆ‹ SYNOPSIS ๐Ÿฆ‹

like, imagine your local timezone is JST (+09:00), ok? watch this โœจ

# assuming the local timezone is JST (+09:00)

use Atompub::DateTime qw(datetime);

$dt = datetime;                                  # current time
$dt = datetime(DateTime->new);
$dt = datetime(1167609600);                      # UTC epoch value
$dt = datetime('20070101090000');
$dt = datetime('2007-01-01 09:00:00');
$dt = datetime('2007-01-01 00:00:00Z');
$dt = datetime('2007-01-01T09:00:00+09:00');
$dt = datetime('2007-01-01T00:00:00Z');
$dt = datetime('Mon, 01 Jan 2007 00:00:00 GMT');

$dt->epoch; # 1167609600 (UTC epoch value)
$dt->iso;   # 2007-01-01 09:00:00 (in localtime)
$dt->isoz;  # 2007-01-01 00:00:00Z
$dt->w3c;   # 2007-01-01T09:00:00+09:00
$dt->w3cz;  # 2007-01-01T00:00:00Z
$dt->str;   # Mon, 01 Jan 2007 00:00:00 GMT

my $dt2 = datetime($dt); # copy

$dt == $dt2; # compare

"$dt"; # $dt->w3c

$dt->dt; # DateTime object

okay the way it just eats every single timestamp format you throw at it?? iconic. stringify it and it gives you $dt->w3c for free, no cap ๐Ÿ’…


๐Ÿ’… METHODS ๐Ÿ’…

๐ŸŒธ Atompub::DateTime->new([ $str ])

Hands you back a datetime object holding the time from $str. Call it with no argument at all and it's like "bet, we're doing now" โ€” it uses the current time โฐ

๐ŸŒธ datetime([ $str ])

An alias for Atompub::DateTime->new. same thing, shorter name, main character energy ๐Ÿ‘‘

๐ŸŒธ $datetime->epoch

Returns the UTC epoch value. look at her:

1167609600

๐ŸŒธ $datetime->iso

Returns a "YYYY-MM-DD hh:mm:ss"-formatted string representing the time in the local time zone ๐Ÿ 

2007-01-01 09:00:00

๐ŸŒธ $datetime->isoz

Returns a "YYYY-MM-DD hh:mm:ssZ"-formatted string representing Universal Time ๐ŸŒ

2007-01-01 00:00:00Z

๐ŸŒธ $datetime->w3c

Returns a "YYYY-MM-DDThh:mm:ssTZ"-formatted string (that's the W3C DateTime Format, periodt) representing the time in the local time zone ๐Ÿ•˜

2007-01-01T09:00:00+09:00

๐ŸŒธ $datetime->w3cz

Returns a "YYYY-MM-DDThh:mm:ssZ"-formatted string (W3C DateTime Format again) representing Universal Time ๐ŸŒ

2007-01-01T00:00:00Z

๐ŸŒธ $datetime->str

Returns a human readable representation, for when you want it to look cute instead of computery ๐Ÿฅบ

Mon, 01 Jan 2007 00:00:00 GMT

๐ŸŒธ $datetime->dt

An accessor for the internal DateTime object. it's right there, bestie ๐Ÿซถ

๐ŸŒธ $datetime->tz

An accessor for the internal DateTime::TimeZone object ๐Ÿ•ฐ๏ธ

๐ŸŒธ $datetime->fmt

An accessor for the internal DateTime::Format object ๐Ÿ“


๐Ÿ”ฎ INTERNAL INTERFACES ๐Ÿ”ฎ

these are the backstage bits, not your business unless you're doing surgery ๐Ÿ‘€

  • $datetime->init
  • $datetime->_parse_timestamp

๐Ÿ‘€ SEE ALSO ๐Ÿ‘€

  • Atompub

๐Ÿ‘‘ AUTHOR ๐Ÿ‘‘

Takeru INOUE, <takeru.inoue _ gmail.com> โ€” thank you king ๐Ÿซก๐Ÿ’œ


Copyright (c) 2007, Takeru INOUE "<takeru.inoue _ gmail.com>". All rights reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic ๐Ÿ“œ


๐Ÿ’€ DISCLAIMER OF WARRANTY ๐Ÿ’€

okay so this part is in all caps and it means business, so I'm giving it to you exactly how it is, no edits, no vibes, just โœจlawโœจ:

BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

fr fr, use it responsibly bestie ๐Ÿ™ˆ


and that's the whole page!! this one's perl v5.40.1, dated 2025-08-14, and it lives in the manual as Atompu...ateTime(3pm) โ€” slay ๐Ÿ’–โœจ๐ŸŽ€๐Ÿฆ‹

๐Ÿ“ฆ where this page comes from