php | 달력 - 이번주 시작/끝, 지난주 시작/끝, 이번달 시작/끝, 저번달 시작/끝
페이지 정보
작성자 100K5 작성일12-04-01 09:32 조회66,460회 댓글0건관련링크
본문
<?
// strtotime($Date)); // 유닉스타임 형식
$Date = "$year-$month-$day";
$YY = date("Y", strtotime($Date));
$MM = date("m", strtotime($Date));
$DD = date("d", strtotime($Date));
$Day = date("w", strtotime($Date));
$this_today = date("Y-m-d", strtotime($YY."-".$MM."-".$DD));
$this_week_start = date("Y-m-d", strtotime($YY."-".$MM."-".$DD." -".$Day." day"));
$this_week_end = date("Y-m-d", strtotime($this_week_start." +6 day"));
$ago_week_start = date("Y-m-d", strtotime($this_week_start." -1 week"));
$ago_week_end = date("Y-m-d", strtotime($this_week_end." -1 week"));
$next_week_start = date("Y-m-d", strtotime($this_week_start." +1 week"));
$next_week_end = date("Y-m-d", strtotime($this_week_end." +1 week"));
$this_month_start = date("Y-m-d", strtotime($YY."-".$MM."-01"));
$this_month_end = date("Y-m-d", strtotime($YY."-".$MM."-".date("t", strtotime($Date)) ));
$ago_month_start = date("Y-m-d", strtotime($this_month_start." -1 month"));
$ago_month_end = date("Y-m-d", strtotime($YY."-".($MM -1)."-".date("t", strtotime($ago_month_start)) ));
// 요일 구하기
$weekday = array("일","월","화","수","목","금","토");
echo("오늘 : ".$this_today." ");
echo("이번주 시작일 : ".$this_week_start." ");
echo("이번주 종료일 : ".$this_week_end." ");
echo("전주 시작일 : ".$ago_week_start." ");
echo("전주 종료일 : ".$ago_week_end." ");
echo("다음주 시작일 : ".$next_week_start." ");
echo("다음주 종료일 : ".$next_week_end." ");
echo("이달 시작일 : ".$this_month_start." ");
echo("이달 종료일 : ".$this_month_end." ");
echo("전달 시작일 : ".$ago_month_start." ");
echo("전달 종료일 : ".$ago_month_end." ");
echo("오늘 요일" : $weekday[date('w', strtotime($Date))]);
?>
댓글목록
등록된 댓글이 없습니다.