The YEAR
type is a one-byte type used for
representing years.
MySQL retrieves and displays YEAR
values in
YYYY
format. The range is
1901
to 2155
.
You can specify 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 1901
to 2155
.
As a two-digit string in the range '00'
to '99'
. Values in the ranges
'00'
to '69'
and
'70'
to '99'
are
converted to YEAR
values in the ranges
2000
to 2069
and
1970
to 1999
.
As a two-digit number in the range 1
to
99
. Values in the ranges
1
to 69
and
70
to 99
are converted
to YEAR
values in the ranges
2001
to 2069
and
1970
to 1999
. 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
as 2000
. You must specify it as a string
'0'
or '00'
or it is
interpreted as 0000
.
As the result of a function that returns a value that is
acceptable in a YEAR
context, such as
NOW()
.
Illegal YEAR
values are converted to
0000
.