DateTime::Format::Pg

DateTime::Format::Pg is a Perl module to parse and format PostgreSQL dates and times.
Download

DateTime::Format::Pg Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Claus A. Frber
  • Publisher web site:
  • http://search.cpan.org/~dmaki/DateTime-Format-Pg-0.15/lib/DateTime/Format/Pg.pm

DateTime::Format::Pg Tags


DateTime::Format::Pg Description

DateTime::Format::Pg is a Perl module to parse and format PostgreSQL dates and times. DateTime::Format::Pg is a Perl module to parse and format PostgreSQL dates and times.SYNOPSIS use DateTime::Format::Pg; my $dt = DateTime::Format::Pg->parse_datetime( '2003-01-16 23:12:01' ); # 2003-01-16T23:12:01+0200 DateTime::Format::Pg->format_datetime($dt);This module understands the formats used by PostgreSQL for its DATE, TIME, TIMESTAMP, and INTERVAL data types. It can be used to parse these formats in order to create DateTime or DateTime::Duration objects, and it can take a DateTime or DateTime::Duration object and produce a string representing it in a format accepted by PostgreSQL.CONSTRUCTORSThe following methods can be used to create DateTime::Format::Pg objects.new( name => value, ... ) Creates a new DateTime::Format::Pg instance. This is generally not required for simple operations. If you wish to use a different parsing style from the default then it is more comfortable to create an object. my $parser = DateTime::Format::Pg->new() my $copy = $parser->new( 'european' => 1 );This method accepts the following options:european If european is set to non-zero, dates are assumed to be in european dd/mm/yyyy format. The default is to assume US mm/dd/yyyy format (because this is the default for PostgreSQL).This option only has an effect if PostgreSQL is set to output dates in the 'PostgreSQL' (DATE only) and 'SQL' (DATE and TIMESTAMP) styles.Note that you don't have to set this option if the PostgreSQL server has been set to use the 'ISO' format, which is the default.server_tz This option can be set to a DateTime::TimeZone object or a string that contains a time zone name.This value must be set to the same value as the PostgreSQL server's time zone in order to parse TIMESTAMP WITH TIMEZONE values in the 'PostgreSQL', 'SQL', and 'German' formats correctly.Note that you don't have to set this option if the PostgreSQL server has been set to use the 'ISO' format, which is the default.clone() This method is provided for those who prefer to explicitly clone via a method called clone(). my $clone = $original->clone();If called as a class method it will die.Requirements:· Perl Requirements: · Perl


DateTime::Format::Pg Related Software