이 출력됩니다 :
$dayDiff = round((strtotime('2012-02-18') - strtotime('2012-02-22'))/86400);
echo $newDate= date('Y-m-d', strtotime($dayDiff . " day", strtotime('2012-02-18')));
나 :
$firstDate = strtotime('2012-02-18');
$dayDiff = round(($firstDate - strtotime('2012-02-22'))/86400);
echo $newDate= date('Y-m-d', strtotime($dayDiff . " day", $firstDate));
는 strtotime
현재 타임 스탬프에서 작동하지에서 않습니다 18 번째 이유는 다음과 같습니다. echo date('Y-m-d', strtotime('now'));
이 출력됩니다 오늘 날짜, echo date('Y-m-d', strtotime('now - 4 days'));
25, 및 echo date('Y-m-d', strtotime('2012-02-18 - 4 days'));
18 -4 일을 출력 14
한 strtotime에
대한 추가 정보 : http://php.net/manual/en/function.strtotime.php
이 해냈어 내가 완전히'strtotime'을 이해하지 못했지만, 감사 설명을 위해 – ToddN
@ToddN 나는 당신이 strtotime에 관해 알 필요가있는 거의 모든 것을 설명하는 첨부 된 링크를 보아라. 하지만 기본적으로 strtotime은 epoc 시간 (1970 1 월 1 일 @ 00:00:00) - http://en.wikipedia.org/wiki/Unix_time에서 시작됩니다. 도움이 더 필요하면 알려주세요. –