PGObje...teTime(3pm)
๐ธ NAME ๐ธ
PGObject::Type::DateTime โ DateTime Wrappers for PGObject
Okay so first things first bestie: this is a 3pm page, aka the "User Contributed Perl Documentation" corner of your manual set, and in the man index it shows up squished down to PGObje...teTime(3pm) because man pages truncate everything ๐ญ iconic honestly.
โจ VERSION โจ
Version 2.0.2 ๐
๐ฆ SYNOPSIS ๐ฆ
PGObject::Type::DateTime->register();
Now all Datetime, Timestamp, and TimestampTZ types are returned as datetime objects ๐
Heads up bestie:Dateandtimemodules may require subclasses to serialize properly to the database. That's just how it is ๐
๐ฎ ONGOING WORK IN 2.X ๐ฎ
During the 2.x series we expect to work on better NULL support ๐ Right now this is all delegated to child classes, but there are likely to be cases where we add this to our library directly.
๐ DESCRIPTION ๐
This module provides a basic wrapper around DateTime so that PGObject-framework types can automatically tie date/time related objects โ but we handle date and timestamp formats in our from_db routines. No cap.
This specific module only supports the ISO YMD datestyle. The MDY or DMY datestyles may be usable in future versions, but datestyles other than ISO raise ambiguity issues โ sufficient that they cannot always even be used in PostgreSQL as input. So like, it's giving "maybe someday" but also "lowkey a whole mess" ๐ฌ
This module also provides basic default handling ๐ง Times are assigned a date of '0001-01-01' and dates are assigned a time of midnight. Whether this is set is persisted, along with whether timezones are set, and these are returned to a valid ISO YMD format on export โ if a date component was initially set.
Which means you can use this for general math without worrying about many of the other niceties โจ Parsing ISO YMD dates and standard times (24 hr format) is supported via the from_db interface, which also provides a useful way of handing dates in. Obsessed with that, honestly ๐ซถ
๐ SUBROUTINES/METHODS ๐
register
By default registers 'date', 'time', 'timestamp', and 'timestamptz' โญ
_new
Constructor for the PGDate object. Fully compliant with the DateTime "_new" constructor, which it uses internally to instantiate objects.
We need to hook this constructor instead of the regular "new" one, because this one is referred to directly on numerous occasions. Yeah. It's that girl for a reason ๐
today
Wraps DateTime::today, clearing the internal flag which causes is_time() to return a non-false value.
last_day_of_month
Wraps DateTime::last_day_of_month, clearing the internal flag which causes is_time() to return a non-false value.
from_day_of_year
Wraps DateTime::from_day_of_year, clearing the internal flag which causes is_time() to return a non-false value.
truncate( to => ... )
Wraps DateTime::from_day_of_year, clearing the internal flag which causes is_time() to return a non-false value, if the to argument is not one of second, minute or hour.
from_db
Parses a date from YYYY-MM-DD format and generates the new object based on it ๐ธ
to_db
Returns the date in YYYY-MM-DD format.
is_date($to_set)
If $to_set is set, sets this. In both cases, returns whether the object is now a date.
is_time($to_set)
If $to_set is set, sets this. In both cases, returns whether the object is now a time.
is_tz($to_set)
If $to_set is set, sets this. In both cases, returns whether the object is now a date.
Not me pointing out that yes, this one says "date" too ๐ that's literally what the original says, I'm just the messenger ๐ซก
๐ AUTHOR ๐
Chris Travers, "<chris.travers at gmail.com>"
๐ BUGS ๐
Please report any bugs or feature requests to "bug-pgobject-type-datetime at rt.cpan.org", or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=PGObject-Type-DateTime.
I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. Bestie support system fr fr ๐ซถ
๐ซถ SUPPORT ๐ซถ
You can find documentation for this module with the perldoc command.
perldoc PGObject::Type::DateTime
You can also look for information at:
- RT: CPAN's request tracker (report bugs here)
http://rt.cpan.org/NoAuth/Bugs.html?Dist=PGObject-Type-DateTime - AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/PGObject-Type-DateTime - CPAN Ratings
http://cpanratings.perl.org/d/PGObject-Type-DateTime - Search CPAN
http://search.cpan.org/dist/PGObject-Type-DateTime/
๐ ACKNOWLEDGEMENTS ๐
This section is literally empty in the original, so we're just gonna stand here and vibe ๐ฆโจ
๐ LICENSE AND COPYRIGHT ๐
Copyright 2013-2017 The LedgerSMB Core Team
This program is released under the following license: BSD
And that's the whole page, bestie! ๐ This one came to you courtesy of perl v5.36.0, dated 2022-11-19, and it lives in the PGObje...teTime(3pm) slot in your man pages. Go forth and wrangle some datetimes, you absolute main character ๐๐
๐ฆ
๐ฆ where this page comes from
- debian bookworm: libpgobject-type-datetime-perl 2.000002-3 ยท BSD-2-Clause
- debian trixie: libpgobject-type-datetime-perl 2.000002-3 ยท BSD-2-Clause
- ubuntu noble: libpgobject-type-datetime-perl 2.000002-3 ยท BSD-2-Clause
- ubuntu resolute: libpgobject-type-datetime-perl 2.000002-3 ยท BSD-2-Clause
- ubuntu stonking: libpgobject-type-datetime-perl 2.000002-3 ยท BSD-2-Clause
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms