.\" Automatically generated by Pod::Man 4.11 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "PGObject::Type::DateTime 3pm" .TH PGObject::Type::DateTime 3pm "2019-12-27" "perl v5.30.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" PGObject::Type::DateTime \- DateTime Wrappers for PGObject .SH "VERSION" .IX Header "VERSION" Version 2.0.2 .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& PGObject::Type::DateTime\->register(); .Ve .PP Now all Datetime, Timestamp, and TimestampTZ types are returned returned as datetime objects. Date and time modules may require subclasses to serialize properly to the database. .SH "ONGOING WORK IN 2.X" .IX Header "ONGOING WORK IN 2.X" During the 2.x series we expect to work on better \s-1NULL\s0 support. Right now this is all delegated to clild classes, but there are likely to be cases where we add this to our library directly. .SH "DESCRIPTION" .IX Header "DESCRIPTION" This module provides a basic wrapper around DateTime to allow PGObject-framework types to automatically tie date/time related objects, but we handle date and timestamp formats in our from_db routines. .PP This specific module only supports the \s-1ISO YMD\s0 datestyle. The \s-1MDY\s0 or \s-1DMY\s0 datestyles may be usable in future versions but datestyles other than \s-1ISO\s0 raise ambiguity issues, sufficient that they cannot always even be used in PostgreSQL as input. .PP 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 \s-1ISO YMD\s0 format on export, if a date component was initially set. .PP This means you can use this for general math without worrying about many of the other nicities. Parsing \s-1ISO YMD\s0 dates and standard times (24 hr format) is supported via the from_db interface, which also provides a useful way of handing dates in. .SH "SUBROUTINES/METHODS" .IX Header "SUBROUTINES/METHODS" .SS "register" .IX Subsection "register" By default registers 'date', 'time', 'timestamp', and 'timestamptz' .SS "_new" .IX Subsection "_new" Constructor for the PGDate object. Fully compliant with DateTime \&\f(CW\*(C`_new\*(C'\fR constructor which it uses internally to instantiate objects. .PP We need to hook this constructor instead of the regular \f(CW\*(C`new\*(C'\fR one, because this one is referred to directly on numerous occasions. .SS "today" .IX Subsection "today" Wraps \f(CW\*(C`DateTime::today\*(C'\fR, clearing the internal flag which causes \f(CW\*(C`is_time()\*(C'\fR to return a non-false value. .SS "last_day_of_month" .IX Subsection "last_day_of_month" Wraps \f(CW\*(C`DateTime::last_day_of_month\*(C'\fR, clearing the internal flag which causes \f(CW\*(C`is_time()\*(C'\fR to return a non-false value. .SS "from_day_of_year" .IX Subsection "from_day_of_year" Wraps \f(CW\*(C`DateTime::from_day_of_year\*(C'\fR, clearing the internal flag which causes \f(CW\*(C`is_time()\*(C'\fR to return a non-false value. .SS "truncate( to => ... )" .IX Subsection "truncate( to => ... )" Wraps \f(CW\*(C`DateTime::from_day_of_year\*(C'\fR, clearing the internal flag which causes \f(CW\*(C`is_time()\*(C'\fR to return a non-false value, if the \f(CW\*(C`to\*(C'\fR argument is not one of \f(CW\*(C`second\*(C'\fR, \f(CW\*(C`minute\*(C'\fR or \f(CW\*(C`hour\*(C'\fR. .SS "from_db" .IX Subsection "from_db" Parses a date from YYYY-MM-DD format and generates the new object based on it. .SS "to_db" .IX Subsection "to_db" Returns the date in YYYY-MM-DD format. .SS "is_date($to_set)" .IX Subsection "is_date($to_set)" If \f(CW$to_set\fR is set, sets this. In both cases, returns whether the object is now a date. .SS "is_time($to_set)" .IX Subsection "is_time($to_set)" If \f(CW$to_set\fR is set, sets this. In both cases, returns whether the object is now a time. .SS "is_tz($to_set)" .IX Subsection "is_tz($to_set)" If \f(CW$to_set\fR is set, sets this. In both cases, returns whether the object is now a date. .SH "AUTHOR" .IX Header "AUTHOR" Chris Travers, \f(CW\*(C`\*(C'\fR .SH "BUGS" .IX Header "BUGS" Please report any bugs or feature requests to \f(CW\*(C`bug\-pgobject\-type\-datetime at rt.cpan.org\*(C'\fR, or through the web interface at . I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. .SH "SUPPORT" .IX Header "SUPPORT" You can find documentation for this module with the perldoc command. .PP .Vb 1 \& perldoc PGObject::Type::DateTime .Ve .PP You can also look for information at: .IP "\(bu" 4 \&\s-1RT: CPAN\s0's request tracker (report bugs here) .Sp .IP "\(bu" 4 AnnoCPAN: Annotated \s-1CPAN\s0 documentation .Sp .IP "\(bu" 4 \&\s-1CPAN\s0 Ratings .Sp .IP "\(bu" 4 Search \s-1CPAN\s0 .Sp .SH "ACKNOWLEDGEMENTS" .IX Header "ACKNOWLEDGEMENTS" .SH "LICENSE AND COPYRIGHT" .IX Header "LICENSE AND COPYRIGHT" Copyright 2013\-2017 The LedgerSMB Core Team .PP This program is released under the following license: \s-1BSD\s0