내가 자꾸 까먹어서 쓰는 개발 이야기/PHP

PHP date() 함수에서 월~일 순으로 요일 구하기

FIL. 2013. 4. 30. 17:24
728x90

NISO-8601 numeric representation of the day of the week (added in PHP 5.1.0)

1 (for Monday) through 7 (for Sunday)


PHP 5.1.0부터 추가됨(이제알았..).


기존 : date("w") -> 0:일요일, 1:월요일, 2:화요일...


추가 : date("N") -> 1:월요일, 2:화요일, 3:수요일...


주간 스케줄과 같은 프로그램을 짤때 월~일을 1~7로 체크할 수 있어서 사용하기 좋을듯.


출처 : http://kr1.php.net/manual/en/function.date.php