1DateTime::Format::MySQLU(s3e)r Contributed Perl DocumentaDtaitoenTime::Format::MySQL(3)
2
3
4
6 DateTime::Format::MySQL - Parse and format MySQL dates and times
7
9 use DateTime::Format::MySQL;
10
11 my $dt = DateTime::Format::MySQL->parse_datetime( '2003-01-16 23:12:01' );
12
13 # 2003-01-16 23:12:01
14 DateTime::Format::MySQL->format_datetime($dt);
15
17 This module understands the formats used by MySQL for its DATE, DATE‐
18 TIME, TIME, and TIMESTAMP data types. It can be used to parse these
19 formats in order to create DateTime objects, and it can take a DateTime
20 object and produce a string representing it in the MySQL format.
21
23 This class offers the following methods. All of the parsing methods
24 set the returned DateTime object's time zone to the floating time zone,
25 because MySQL does not provide time zone information.
26
27 * parse_datetime($string)
28 * parse_date($string)
29 * parse_timestamp($string)
30 Given a value of the appropriate type, this method will return a
31 new "DateTime" object. The time zone for this object will always
32 be the floating time zone, because by MySQL stores the local date‐
33 time, not UTC.
34
35 If given an improperly formatted string, this method may die.
36
37 * format_date($datetime)
38 * format_time($datetime)
39 * format_datetime($datetime)
40 Given a "DateTime" object, this methods returns an appropriately
41 formatted string.
42
44 Support for this module is provided via the datetime@perl.org email
45 list. See http://lists.perl.org/ for more details.
46
48 Dave Rolsky <autarch@urth.org>
49
51 Copyright (c) 2003 David Rolsky. All rights reserved. This program is
52 free software; you can redistribute it and/or modify it under the same
53 terms as Perl itself.
54
55 The full text of the license can be found in the LICENSE file included
56 with this module.
57
59 datetime@perl.org mailing list
60
61 http://datetime.perl.org/
62
63
64
65perl v5.8.8 2006-09-08 DateTime::Format::MySQL(3)