开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜