function firstOfMonth() {
return date("m/d/Y", strtotime(date('m').'/01/'.date('Y').' 00:00:00'));
}
function lastOfMonth() {
return date("m/d/Y", strtotime('-1 second',strtotime('+1 month',strtotime(date('m').'/01/'.date('Y').' 00:00:00'))));
}
이 달의 첫날 날짜와 마지막 날 날짜를 가져와야합니다.PHP에서 첫 번째 특정 날짜와 마지막 날짜를 잡는 중
이제 alittle을 변경하고 싶습니다. 두 함수 모두에 $ month 매개 변수가 있습니다. $ month에는 첫 번째 날짜와 마지막 날짜를 얻고 자하는 달의 숫자가 저장됩니다.
내가 firstOfMonth (1), 나는 그것이 2012-01-01을 반환하고 lastOfMonth (1)가 반환해야 원하는 경우예 2012-01-31
내가 어떻게 할 수 있습니까?
[ 한 달의 첫날과 마지막 날을 얻는 법] (http://stackoverflow.com/questions/7541938/how-to-get-the-first-and-last-days-of-a-give-month) – deceze