Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要一个包含全年日期的 SQL 表。
是否有任何 mysql 查询或 php 代码可以帮助我生成包含全年日期行的 SQL 表?
例如:表1:
date book 01-01-2013 02-01-2013 03-01-2013 04-01-2013 05-01-2013 ... .. ... 31-12-2013
希望你能理解我的问题!:)
只需用 mysql(i) 查询替换 echo,php 将计算所有日期
$Date = new DateTime('2013-01-01 00:00'); $End = new DateTime('2013-12-31 00:00'); while($Date <= $End) { echo $Date->format('Y-m-d H:i') . "<br/>"; $Date->modify('+1 DAY'); }