나는 strtotime
을 사용하여 그 달의 마지막 날을 얻으려고합니다. 아래의 코드에 무슨 문제가 있는지 모르겠습니다. 어떤 사람이 문제를 해결할 수 있습니까?PHP를 사용하여 월의 마지막 날을 얻는 방법
$string = 'Jun';
$month_number = date("m",strtotime($string));
$calcstart_date = date('Y-'.$month_number.'-01').' 00:00:00';
echo $calcend_date = date('Y-'.$month_number.'-t').' 11:59:00';
rtfm : http://php.net/date 두 번째 인수로 date()의 타임 스탬프를 제공하지 않으면 TODAY가 사용됩니다. 그러므로 당신은 6 월이 아닌 8 월에't' 값을 생성합니다. –
[날짜의 마지막 날을 찾는 방법?] (http://stackoverflow.com/questions/1686724/how-to-find-the-last-day-of-the-month-from) -date) – andreas
이것은 중복 질문이 아닙니다. @Andreas –