해당하는 날짜가 그달의 몇주째인지 계산 > php

본문 바로가기

php

해당하는 날짜가 그달의 몇주째인지 계산

작성일 19-08-22 15:56

페이지 정보

작성자서방님 조회 75회 댓글 0건

본문

<?
function toWeekNum($timestamp) {
	$w = date("w", mktime(0,0,0, date("n",$timestamp), 1, date("Y",$timestamp)));
	return ceil(($w + date("j",$timestamp) -1) / 7);
}

$weekNo = toWeekNum(time());
?>
=======================================
<?
$today_date = "2019-08-22";
$currentWeek = ceil((date("d",strtotime($today_date)) - date("w",strtotime($today_date)) - 1) / 7) + 1; // 해당월의 몇주차
?>

댓글목록

등록된 댓글이 없습니다.

게시물 검색
Copyright © 서방님.kr All rights reserved.
PC 버전으로 보기