The YEAR type is a one-byte type
used for representing years. It can be declared as
YEAR(2) or YEAR(4) to
specify a display width of two or four characters. The default
is four characters if no width is given.
For four-digit format, MySQL displays
YEAR values in
YYYY format, with a range of
1901 to 2155, or
0000. For two-digit format, MySQL displays
only the last two (least significant) digits; for example,
70 (1970 or 2070) or 69
(2069).
You can specify input YEAR values
in a variety of formats:
As a four-digit string in the range
'1901'to'2155'.As a four-digit number in the range
1901to2155.As a two-digit string in the range
'00'to'99'. Values in the ranges'00'to'69'and'70'to'99'are converted toYEARvalues in the ranges2000to2069and1970to1999.As a two-digit number in the range
1to99. Values in the ranges1to69and70to99are converted toYEARvalues in the ranges2001to2069and1970to1999. Note that the range for two-digit numbers is slightly different from the range for two-digit strings, because you cannot specify zero directly as a number and have it be interpreted as2000. You must specify it as a string'0'or'00'or it is interpreted as0000.As the result of a function that returns a value that is acceptable in a
YEARcontext, such asNOW().
Illegal YEAR values are converted
to 0000.