DateTime::Format::MySQL(3pm)

DateTime::Format::MySQL3pm

Parse and format mysql dates and times

Usage

  use DateTime::Format::MySQL;
  my $dt = DateTime::Format::MySQL->parse_datetime( '2003-01-16 23:12:01' );
  # 2003-01-16 23:12:01
  DateTime::Format::MySQL->format_datetime($dt);

Overview

This module understands the formats used by MySQL for its DATE, DATETIME, TIME, and TIMESTAMP data types. It can be used to parse these formats in order to create DateTime objects, and it can take a DateTime object and produce a string representing it in the MySQL format.

Methods

This class offers the following methods. All of the parsing methods set the returned DateTime object's time zone to the floating time zone, because MySQL does not provide time zone information.

•

parse_datetime($string)

•

parse_date($string)

•

parse_timestamp($string)

Given a value of the appropriate type, this method will return a new "DateTime" object. The time zone for this object will always be the floating time zone, because by MySQL stores the local datetime, not UTC.

If given an improperly formatted string, this method may die.

•

format_date($datetime)

•

format_time($datetime)

•

format_datetime($datetime)

Given a "DateTime" object, this methods returns an appropriately formatted string.

Support

Support for this module is provided via the [email protected] email list. See http://lists.perl.org/ for more details.

Releases

10 releases since Debian 4.0 (Etch); the text changed 4 times.

  1. 4.0–7
  2. 8
  3. 9–11
  4. 12
  5. 13

Author

Dave Rolsky <[email protected]>

From libdatetime-format-mysql-perl 0.08-1 in Debian 13 (Trixie). Parsed by carta from the page's man source.