PGObject::Type::DateTime(3) DateTime Wrappers for PGObject

VERSION

Version 1.0.3

SYNOPSIS


PGObject::Type::DateTime->register();

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.

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.

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.

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.

This means you can use this for general math without worrying about many of the other nicities. 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.

SUBROUTINES/METHODS

register

By default registers 'date', 'time', 'timestamp', and 'timestamptz'

new

Constructor for the PGDate object. Fully compliant with DateTime constructor

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.

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.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc PGObject::Type::DateTime

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

Copyright 2013 Chris Travers.

This program is released under the following license: BSD