PHP和MySQL的最小和最大可能日期 [英] PHP and MySQL smallest and largest possible date
问题描述
PHP和MySQL可以识别的最大日期是什么?
What is the largest date PHP and MySQL recognizes?
我的意思是,对于不同的时间轴,我具有不同的值,并且我想使它们全部成为MySQL中的BETWEEN
选择,就像这样:
I mean, I have different values for different timeline and I want to make them all as BETWEEN
selects in MySQL, like this:
SELECT * FROM table WHERE date BETWEEN '2011-10-01' AND '2011-10-02';
SELECT * FROM table WHERE date BETWEEN '2011-10-03' AND '2011-10-10';
等
要获得所有选择,正在想像这样的事情:
To get all options, was thinking of something like this:
SELECT * FROM table WHERE date BETWEEN '0000-01-01' AND '2011-10-01';
SELECT * FROM table WHERE date BETWEEN '2011-10-02' AND '2011-10-10';
SELECT * FROM table WHERE date BETWEEN '2011-10-11' AND '9999-12-31';
这将始终有效吗,或者代码有可能在某个时候中断?
Will this always work or is there a chance the code might break at some point?
推荐答案
DATE类型用于具有日期部分但没有时间部分的值. MySQL检索并以"YYYY-MM-DD"格式显示DATE值.支持的范围是"1000-01-01"至"9999-12-31".
The DATE type is used for values with a date part but no time part. MySQL retrieves and displays DATE values in 'YYYY-MM-DD' format. The supported range is '1000-01-01' to '9999-12-31'.
取自 http://dev.mysql.com/doc/refman/5.5/en/datetime.html
这篇关于PHP和MySQL的最小和最大可能日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!