소

월별 말일 표시는 어떻게 하나요?

· 2012-05-17 (목) 23:56:22 · 1673 · 3
3월 31일 , 4월 30일 등...
각 월의 말일을 표시할 때는 어케해야하나요?

$last_month_31=date("Y-m-31",strtotime('last month'));

이렇게 하다보니..에궁.. 2012-04-31 되네요..
|

댓글 3개

검색해서 찾았습니다.
이번달의 마지막 날을 출력합니다.

date(’Y-m-d’,strtotime(’-1 second’,strtotime(’+1 month’,strtotime(date(’m').’/01/’.date(’Y').’ 00:00:00′))));

지난달
date(’Y-m-d’,strtotime(’-1 second’,strtotime(date(’m').’/01/’.date(’Y').’ 00:00:00′)));
지지난달
date(’Y-m-d’,strtotime(’-1 second’,strtotime(’-1 month’,strtotime(date(’m').’/01/’.date(’Y').’ 00:00:00′))));

다음달
date(’Y-m-d’,strtotime(’-1 second’,strtotime(’+2 month’,strtotime(date(’m').’/01/’.date(’Y').’ 00:00:00′))));
date("Y-m-t",time());
date("Y-m-t", strtotime("last month"));
date("Y-m-t", strtotime("next month"));
헉.. 역시 균이님.. ^^
t 포멧이 있었군요.
댓글을 작성하시려면 로그인이 필요합니다.

그누4 질문답변

66,531건

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기 기존 게시물은 열람만 가능합니다.

+
제목 글쓴이 날짜 조회
12-05-19 조회 1,066
12-05-19 조회 1,684
12-05-19 조회 894
12-05-19 조회 4,086
12-05-18 조회 1,069
12-05-18 조회 1,069
12-05-18 조회 1,864
12-05-18 조회 1,243
12-05-18 조회 1,070
12-05-18 조회 1,615
12-05-18 조회 1,075
12-05-18 조회 1,083
12-05-18 조회 1,010
12-05-18 조회 1,342
12-05-18 조회 1,839
12-05-18 조회 1,167
12-05-18 조회 845
12-05-18 조회 1,836
12-05-18 조회 2,855
12-05-17 조회 1,674