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,
18 DATETIME, TIME, and TIMESTAMP data types. It can be used to parse
19 these formats in order to create DateTime objects, and it can take a
20 DateTime object and produce a string representing it in the MySQL
21 format.
22
24 This class offers the following methods. All of the parsing methods
25 set the returned DateTime object's time zone to the floating time zone,
26 because MySQL does not provide time zone information.
27
28 • parse_datetime($string)
29
30 • parse_date($string)
31
32 • parse_timestamp($string)
33
34 Given a value of the appropriate type, this method will return a
35 new "DateTime" object. The time zone for this object will always
36 be the floating time zone, because by MySQL stores the local
37 datetime, not UTC.
38
39 If given an improperly formatted string, this method may die.
40
41 • format_date($datetime)
42
43 • format_time($datetime)
44
45 • format_datetime($datetime)
46
47 Given a "DateTime" object, this methods returns an appropriately
48 formatted string.
49
51 Support for this module is provided via the datetime@perl.org email
52 list. See http://lists.perl.org/ for more details.
53
55 Dave Rolsky <autarch@urth.org>
56
58 Copyright (c) 2003-2014 David Rolsky. All rights reserved. This
59 program is free software; you can redistribute it and/or modify it
60 under the same terms as Perl itself.
61
62 The full text of the license can be found in the LICENSE file included
63 with this module.
64
66 datetime@perl.org mailing list
67
68 http://datetime.perl.org/
69
70
71
72perl v5.36.0 2022-07-22 DateTime::Format::MySQL(3)