2009년 7월 28일 화요일

php에서 날짜 계산하기

echo strftime("%Y-%m-%d", strtotime("now")), "<br>\n";
echo strftime("%Y-%m-%d", strtotime("10 September 2000")), "<br>\n";
echo "하루전 ".strftime("%Y-%m-%d", strtotime("-1 day")), "<br>\n";
echo "내일 ".strftime("%Y-%m-%d", strtotime("+1 day")), "<br>\n";
echo "일주일 전 ".strftime("%Y-%m-%d", strtotime("-1 week")), "<br>\n";
echo "일주일 후 ".strftime("%Y-%m-%d", strtotime("+1 week")), "<br>\n";
echo "일주일 + 2일 + 4시간 +2초 ".strftime("%Y-%m-%d %H:%M:%S", strtotime("+1 week 2 days 4 hours 2 seconds")), "<br>\n";
echo "다음주 수요일 ".strftime("%Y-%m-%d", strtotime("next Thursday")), "<br>\n";
echo "마지막 월요일 ".strftime("%Y-%m-%d ", strtotime("last Monday")), "<br>\n";

댓글 없음:

댓글 쓰기