Oracle 5.0 Reference Manual page 860

Table of Contents

Advertisement

The
data type is used for values that contain both date and time parts.
TIMESTAMP
range of
'1970-01-01 00:00:01'
MySQL converts
TIMESTAMP
UTC to the current time zone for retrieval. (This does not occur for other types such as DATETIME.) By
default, the current time zone for each connection is the server's time. The time zone can be set on a
per-connection basis. As long as the time zone setting remains constant, you get back the same value
you store. If you store a
the retrieved value is different from the value you stored. This occurs because the same time zone
was not used for conversion in both directions. The current time zone is available as the value of the
[500]
system variable. For more information, see
time_zone
Support".
The
data type offers automatic initialization and updating to the current date and time. For
TIMESTAMP
more information, see
A
or
DATETIME
TIMESTAMP
(6 digits) precision. Although this fractional part is recognized, it is discarded from values stored into
or
DATETIME
TIMESTAMP
Section 11.1.5.6, "Fractional Seconds in Time
Illegal DATE, DATETIME, or
type
('0000-00-00'
Be aware of certain properties of date value interpretation in MySQL:
• MySQL permits a "relaxed" format for values specified as strings, in which any punctuation character
may be used as the delimiter between date parts or time parts. In some cases, this syntax can be
deceiving. For example, a value such as
":" delimiter, but is interpreted as the year
is converted to
'10:45:15'
• As of 5.0.2, the server requires that month and day values be legal, and not merely in the range 1
to 12 and 1 to 31, respectively. With strict mode disabled, invalid dates such as
converted to
'0000-00-00'
generate an error. To permit such dates, enable
"Server SQL
Modes", for more information.
Before MySQL 5.0.2, the MySQL server performs only basic checking on the validity of a date: The
ranges for year, month, and day are 1000 to 9999, 00 to 12, and 00 to 31, respectively. Any date
containing parts not within these ranges is subject to conversion to '0000-00-00'. Please note that
this still permits you to store invalid dates such as '2002-04-31'. To ensure that a date is valid,
you should perform a check in your application.
• As of MySQL 5.0.2, MySQL does not accept
month column or values that are not a valid date. The sole exception to this rule is the special "zero"
value
'0000-00-00
• Dates containing two-digit year values are ambiguous because the century is unknown. MySQL
interprets two-digit year values using these rules:
• Year values in the range
• Year values in the range
See also
Section 11.1.5.8, "Two-Digit Years in
Note
The MySQL server can be run with the
case,
Date and Time Types
UTC to
values from the current time zone to UTC for storage, and back from
value, and then change the time zone and retrieve the value,
TIMESTAMP
Section 11.1.5.5, "Automatic Initialization and Updating for
value can include a trailing fractional seconds part in up to microseconds
columns. For information about fractional seconds support in MySQL, see
values are converted to the "zero" value of the appropriate
TIMESTAMP
or
'0000-00-00
00:00:00').
'10:11:12'
'2010-11-12'
'0000-00-00'
and a warning is generated. With strict mode enabled, invalid dates
00:00:00'.
are converted to 2000-2069.
00-69
are converted to 1970-1999.
70-99
is identical with DATETIME. If this mode is enabled at the
TIMESTAMP
840
'2038-01-19 03:14:07'
Section 10.6, "MySQL Server Time Zone
Values".
might look like a time value because of the
if used in a date context. The value
because
is not a legal month.
'45'
ALLOW_INVALID_DATES
values that include a zero in the day or
TIMESTAMP
Dates".
[540]
MAXDB
TIMESTAMP
UTC.
TIMESTAMP".
'2004-04-31'
[535]. See
Section 5.1.7,
SQL mode enabled. In this
has a
are

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents