2
$date['start'] = date("o-m-d", mktime(0, 0, 0, 1, 1, 2010));
$date['end'] = date("o-m-d", mktime(0, 0, 0, 2, 1, 2010));

每个元素2009-01-01分别包含2010-02-01。为什么第一个元素返回 2009,而它已被指定为 2010?

我想要实现的是指定可以在 MySQL 查询中使用的日期,例如:

SELECT subject, created_on FROM issues WHERE created_on BETWEEN 2010-01-01 AND 2010-02-01 ORDER BY created_on

4

1 回答 1

3

"Y-m-d"日期格式不应该"o-m-d"

参考:http ://www.php.net/manual/en/function.date.php

o   ISO-8601 year number. This has the same value as Y, except that if the ISO week number (W) belongs to the previous or next year, that year is used instead. (added in PHP 5.1.0)    Examples: 1999 or 2003
Y   A full numeric representation of a year, 4 digits   Examples: 1999 or 2003
于 2013-03-28T12:06:28.533 回答