Datatype Category: DATE/TIME
Datatype Info:
A year in 2- or 4-digit format (default is 4-digit). The allowable values are 1901 to 2155, 0000 in the 4-digit year format, and 1970-2069 if you use the 2-digit format (70-69). MySQL displays YEAR values in YYYY format, but allows you to assign values to YEAR columns using either strings or numbers. (The YEAR type is unavailable prior to MySQL Version 3.22.) See section 6.2.2.4 The YEAR Type.
The above is about mysql year type.
So if I input the value is run say 1800, it will give me the 0000 even I set up the default value of that field (type: year) to be NULL.
So for a valid year value, I need to test the range either "1901"<$input<"2155" "00"<$input<"99", otherwise, I will set it to NULL. Then I will not have the "0000" shown in my year type field.
Is there a simple way to deal with the validation of the mysql "year" type? The "year" type is good for what kind situations?
Thanks!