GNU Info

Info Node: (mysql.info)Y2K issues

(mysql.info)Y2K issues


Next: DATETIME Prev: Date and time types Up: Date and time types
Enter node , (file) or (file)node

Y2K Issues and Date Types
.........................

MySQL itself is Y2K-safe (Note: Year 2000 compliance), but input
values presented to MySQL may not be.  Any input containing 2-digit
year values is ambiguous, because the century is unknown.  Such values
must be interpreted into 4-digit form because MySQL stores years
internally using four digits.

For `DATETIME', `DATE', `TIMESTAMP', and `YEAR' types, MySQL interprets
dates with ambiguous year values using the following rules:

   * Year values in the range `00-69' are converted to `2000-2069'.

   * Year values in the range `70-99' are converted to `1970-1999'.

Remember that these rules provide only reasonable guesses as to what
your data mean.  If the heuristics used by MySQL don't produce the
correct values, you should provide unambiguous input containing 4-digit
year values.

`ORDER BY' will sort 2-digit `YEAR/DATE/DATETIME' types properly.

Note also that some functions like `MIN()' and `MAX()' will convert a
`TIMESTAMP/DATE' to a number. This means that a timestamp with a
2-digit year will not work properly with these functions.  The fix in
this case is to convert the `TIMESTAMP/DATE' to 4-digit year format or
use something like `MIN(DATE_ADD(timestamp,INTERVAL 0 DAYS))'.


automatically generated by info2www version 1.2.2.9