strtotime 함수를 이용한 시간 및 날짜 변경하는 방법
출처 : http://blog.naver.com/PostList.nhn?blogId=rzip84¤tPage=57
[ strtotime 함수 ]
문자열 형태의 날짜를 입력받아 UNIX의 값으로 돌려주는 함수다.
Ex )
$regdate = "2010-05-10"; 이라면 하루전 날짜인 "2010-05-09" 를 문자열로 구하려고 할때...
$beforeday = date("Y-m-d", strtotime($reagdate." -1 day"));
※ 그밖에...
현재 : strtotime($regdate." now"));
내일 : strtotime($regdate."+1 day"));
일주일후 : strtotime($regdate." +1 week"));
한달전 : strtotime($regdate." -1 month"));
다음주 목요일 : strtotime($regdate." next Thursday"));
지난 월요일 : strtotime($regdate." last Monday"));
출처 : http://blog.naver.com/PostList.nhn?blogId=rzip84¤tPage=57
'PHP' 카테고리의 다른 글
★ php ★ php에서 변수값을 함수이름으로 사용하여 함수 실행하는 방법 (0) | 2011.05.08 |
---|---|
UTF-8기준 , php에서 한글 자르는 방법 (0) | 2010.08.28 |
PHP 환경변수 정리 (0) | 2010.08.28 |
PHP 클래스 사용방법 정리 (1) | 2010.08.28 |
repace을 이용한 정규식 모음 (0) | 2010.08.28 |