일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
- 개복숭아판매
- 야생개복숭아
- 태안수영장펜션
- 한라산
- 개복숭아
- 제주도눈
- 포천가볼만한곳
- 포천투어
- 조경철천문대
- wp-900
- 잠실수영장
- 경기북부골프장
- 휘닉스파크
- 괌
- 개복숭아 판매
- 서원힐스
- 충주골프장
- 제주도눈썰매
- 자연산개복숭아
- 파주골프장
- 포천온천
- 야생개복숭아 판매
- 돌복숭아
- LGG6
- 자연산 개복숭아
- 제주도
- 괌자유여행
- 포천수영장
- 제주도설경
- 덕소골프샵
- Today
- Total
Live Brilliant
해당 주(월)의 시작일과 마지막일자 구하는 방법 본문
//넘어오는 변수값이 없으면 오늘 기준으로 값 설정
if(!$thisY) $thisY = date("Y");
if(!$thisM) $thisM = date("m");
if(!$thisD) $thisD = date("d");
$thisW = date("w",mktime(12,12,12,$thisM,$thisD,$thisY)); // 0(일요일)에서 6(토요일)
// 해당 주차의 시작 날짜 (일요일)..timestamp
$thisStartW = mktime(0,0,0,$thisM,$thisD-$thisW,$thisY);
// 해당 주차의 마지막 날짜 (토요일)..timestamp
$thisEndW = mktime(23,59,59,$thisM,$thisD+(6-$thisW),$thisY);
// 해당 월의 시작 날짜 (1일).. timestamp
$thisStartM = mktime(0,0,0,$thisM,1,$thisY);
// 해당 월의 마지막 날짜 (마지막날)..timestamp
// date 옵션 `t` 주어진 월의 일수 ( 28~31)
$thisEndM = mktime(23,59,59,$thisM,date("t",$thisStartM),$thisY);
// 주간 만근에 대한 처리
$sql = "select * from event_attend where mnum='$mnum' and date > $thisStartW and date < $thisEndW";
$result = mysql_query($sql) or die($sql);
$thisWeekCount = mysql_num_rows($result); // 해당주간의 출석 카운터.. 0 이면 출석한번도 안 함 사람, 7이면 만근..
// 월간 만근에 대한 처리
$sqlM = "select * from event_attend where mnum='$mnum' and date > $thisStartM and date < $thisEndM";
$resultM = mysql_query($sqlM) or die($sqlM);
$thisMonthCount = mysql_num_rows($resultM); // 해당 월의 출석 카운터
date("w") : 0(일요일)에서 6(토요일)
'개발은 핵찜이야 > PHP' 카테고리의 다른 글
PHP OOP 프로그래밍 (0) | 2012.07.02 |
---|---|
hash md5 reverse (0) | 2012.05.18 |
페이지 로딩시간 표시 (0) | 2012.04.13 |
ob_start() , ob_end_flush() 함수 사용 (0) | 2012.04.13 |
암호화 소스( 숫자 암호화,숫자 복호화) (0) | 2012.04.13 |