Way to store dates with missing days/months in mysql (php)
I want to store dates in mysql so I set the table to be of type 'Date', which is fine but mysql requires that the full date is provided YYYY-MM-DD.
However some of my data does not include day and some is missing the month. Now I could just use a varchar(10) field, but then its difficult to run date based queries on the data.
Is there another date format whi开发者_如何学JAVAch is not as strong and would allow me to use ?? or 00 where the day/month is not known?
Following from Babiker's answer, this is what the documentation says:
Ranges for the month and day specifiers begin with zero due to the fact that MySQL allows the storing of incomplete dates such as '2014-00-00'.
You can replace with zeros.
精彩评论