为什么mktime()返回意想不到的结果?


Why is mktime() returning unexpected results?

$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

日期格式应为"Y-m-d" NOT "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