2013-03-28 2 views
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로 반환되는 이유는 무엇입니까?mktime()이 예기치 않은 결과를 반환하는 이유는 무엇입니까?

는 내가 달성하기 위해 시도하고 같은 나는 MySQL의 쿼리에서 사용할 수있는 날짜를 지정하는 것입니다해야

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

답변

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 
+0

글쎄, 충분히 조심스럽게 매뉴얼 페이지를 읽지 못해서 얻은 것입니다! 고맙습니다. – njp

+0

@DesmondWolf : 예 : D –

관련 문제