1DateTime::Format::SQLitUes(e3r)Contributed Perl DocumentDaattieoTnime::Format::SQLite(3)
2
3
4

NAME

6       DateTime::Format::SQLite - Parse and format SQLite dates and times
7

SYNOPSIS

9         use DateTime::Format::SQLite;
10
11         my $dt = DateTime::Format::SQLite->parse_datetime( '2003-01-16 23:12:01' );
12
13         # 2003-01-16 23:12:01
14         DateTime::Format::SQLite->format_datetime($dt);
15

DESCRIPTION

17       This module understands the formats used by SQLite for its "date",
18       "datetime" and "time" functions.  It can be used to parse these formats
19       in order to create DateTime objects, and it can take a DateTime object
20       and produce a timestring accepted by SQLite.
21
22       NOTE: SQLite does not have real date/time types but stores everything
23       as strings. This module deals with the date/time strings as
24       understood/returned by SQLite's "date", "time", "datetime", "julianday"
25       and "strftime" SQL functions.  You will usually want to store your
26       dates in one of these formats.
27

METHODS

29       This class offers the methods listed below.  All of the parsing methods
30       set the returned DateTime object's time zone to the UTC zone because
31       SQLite does always uses UTC for date calculations.  This means your
32       dates may seem to be one day off if you convert them to local time.
33
34       •   parse_datetime($string)
35
36           Given a $string representing a date, this method will return a new
37           "DateTime" object.
38
39           The $string may be in any of the formats understood by SQLite's
40           "date", "time", "datetime", "julianday" and "strftime" SQL
41           functions or it may be in the format returned by these functions
42           (except "strftime", of course).
43
44           The time zone for this object will always be in UTC because SQLite
45           assumes UTC for all date calculations.
46
47           If $string contains no date, the parser assumes 2000-01-01 (just
48           like SQLite).
49
50           If given an improperly formatted string, this method may die.
51
52       •   parse_date($string)
53
54       •   parse_time($string)
55
56       •   parse_julianday($string)
57
58           These are aliases for "parse_datetime", for symmetry with
59           "format_*" functions.
60
61       •   format_date($datetime)
62
63           Given a "DateTime" object, this methods returnes a string in the
64           format YYYY-MM-DD, i.e. in the same format SQLite's "date" function
65           uses.
66
67       •   format_time($datetime)
68
69           Given a "DateTime" object, this methods returnes a string in the
70           format HH:MM:SS, i.e. in the same format SQLite's "time" function
71           uses.
72
73       •   format_datetime($datetime)
74
75           Given a "DateTime" object, this methods returnes a string in the
76           format YYYY-MM-DD HH:MM:SS, i.e. in the same format SQLite's
77           "datetime" function uses.
78
79       •   format_julianday($datetime)
80
81           Given a "DateTime" object, this methods returnes a string in the
82           format DDDDDDDDDD, i.e. in the same format SQLite's "julianday"
83           function uses.
84

AUTHOR

86       Claus Färber <CFAERBER@cpan.org>
87
88       based on "DateTime::Format::MySQL" by David Rolsky.
89
90
91       Copyright © 2008 Claus Färber.
92
93       Copyright © 2003 David Rolsky.
94
95       This program is free software; you can redistribute it and/or modify it
96       under the same terms as Perl itself.
97
98       The full text of the license can be found in the LICENSE file included
99       with this module.
100

SEE ALSO

102       http://datetime.perl.org/
103
104       http://www.sqlite.org/lang_datefunc.html
105
106
107
108perl v5.36.0                      2023-01-20       DateTime::Format::SQLite(3)
Impressum