Oracle 5.0 Reference Manual page 861

Table of Contents

Advertisement

11.1.5.2. The
TIME
MySQL retrieves and displays
hours values).
be so large because the
less than 24 hours), but also elapsed time or a time interval between two events (which may be much
greater than 24 hours, or even negative).
MySQL recognizes
Literals". Some of these formats can include a trailing fractional seconds part in up to microseconds (6
digits) precision. Although this fractional part is recognized, it is discarded from values stored into
columns. For information about fractional seconds support in MySQL, see
Seconds in Time
Be careful about assigning abbreviated values to a
values with colons as time of the day. That is,
MySQL interprets abbreviated values without colons using the assumption that the two rightmost digits
represent seconds (that is, as elapsed time rather than as time of day). For example, you might think of
and
'1112'
as
'00:11:12'
By default, values that lie outside the
closest endpoint of the range. For example,
'-838:59:59'
because
'00:00:00'
stored in a table, whether the original value was specified as
For more restrictive treatment of invalid
See
Section 5.1.7, "Server SQL
11.1.5.3. The
YEAR
The
type is a 1-byte type used to represent year values. It can be declared as
YEAR
to specify a display width of four or two characters. The default is four characters if no width
YEAR(2)
is given.
and
YEAR(4)
MySQL displays
format, MySQL displays only the last two (least significant) digits; for example,
(2069).
You can specify input
• As a 4-digit string in the range
• As a 4-digit number in the range
• As a 1- or 2-digit string in the range
are converted to
'99'
Date and Time Types
time that a table is created,
columns. As a result, such columns use
same range of values, and there is no automatic initialization or updating to the
current date and time. See
Type
TIME
values may range from
TIME
type can be used not only to represent a time of day (which must be
TIME
values in several formats, described in
TIME
Values".
as meaning
1112
'11:12:00'
(11 minutes, 12 seconds). Similarly,
and '838:59:59'. Illegal
is itself a legal
Modes".
Type
Note
The
data type has certain issues that you should consider before
YEAR(2)
choosing to use it. For more information, see
Limitations and Migrating to
differ in display format, but have the same range of values. For 4-digit format,
YEAR(2)
values in
YEAR
YYYY
values in a variety of formats:
YEAR
'1901'
1901
values in the ranges
YEAR
TIMESTAMP
Section 5.1.7, "Server SQL
values in
'HH:MM:SS'
'-838:59:59'
column. MySQL interprets abbreviated
TIME
means '11:12:00', not '00:11:12'.
'11:12'
(12 minutes after 11 o'clock), but MySQL interprets them
'12'
range but are otherwise legal are clipped to the
TIME
'-850:00:00'
values are converted to '00:00:00'. Note that
TIME
value, there is no way to tell, from a value of
TIME
values, enable strict SQL mode to cause errors to occur.
TIME
YEAR(4)".
format, with a range of
to '2155'.
to 2155.
to '99'. Values in the ranges
'0'
to
2000
841
columns are created as
display format, have the
DATETIME
Modes".
format (or
'HHH:MM:SS'
to '838:59:59'. The hours part may
Section 9.1.3, "Date and Time
Section 11.1.5.6, "Fractional
and
are interpreted as '00:00:12'.
12
and
are converted to
'850:00:00'
or whether it was illegal.
'00:00:00'
Section 11.1.5.4,
to 2155, or 0000. For 2-digit
1901
70
to
'0'
'69'
and
to 1999.
2069
1970
DATETIME
format for large
TIME
TIME
'00:00:00'
or
YEAR(4)
"YEAR(2)
(1970 or 2070) or
69
and
to
'70'

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents