NAME

Time::Piece::MySQL - Adds MySQL-specific methods to Time::Piece

SYNOPSIS

use Time::Piece::MySQL;

my $time = localtime;

print $time->mysql_datetime;
print $time->mysql_date;
print $time->mysql_time;

my $time = Time::Piece->from_mysql_datetime( $mysql_datetime );
my $time = Time::Piece->from_mysql_date( $mysql_date );
my $time = Time::Piece->from_mysql_timestamp( $mysql_timestamp );

DESCRIPTION

Using this module instead of, or in addition to Time::Piece adds a few MySQL-specific date/time methods to Time::Piece objects.

OBJECT METHODS

  • mysql_date

  • mysql_time

  • mysql_datetime

  • mysql_timestamp

    Returns the date and/or time in a format suitable for use by MySQL.

CONSTRUCTORS

  • from_mysql_date

  • from_mysql_datetime

  • from_mysql_timestamp

    Given a date, date/time, or timestamp as returned from MySQL, these constructors return a new Time::Piece object.

BUGS

Time::Piece itself only works with times in the Unix epoch, this module has the same limitation. However, MySQL itself handles date and datetime columns from '1000-01-01' to '9999-12-31'. Feeding in times outside of the Unix epoch to any of the constructors has unpredictable results.

AUTHOR

Original author: Dave Rolsky <autarch@urth.org>

Current maintainer: Marty Pauley <marty+perl@kasei.com>

COPYRIGHT

(c) 2002 Dave Rolsky

(c) 2003 Marty Pauley

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

Time::Piece