오늘 어제 이전달 기간계산 > PHP

본문 바로가기
사이트 내 전체검색

PHP

오늘 어제 이전달 기간계산

페이지 정보

profile_image
작성자 최고관리자
댓글 0건 조회 4,898회 작성일 21-02-09 11:51

본문

오늘
$tdate = date("Y-m-d");

어제
$ydate = date("Y-m-d", (time()-86400));

이전달
$mdate = date("Y-m",strtotime("-1 month"));


 // 기간별 달 계산  //
 (ex : 2012-11-30일에서 한달간 광고를 하면 마감일은 2012-12-29일이 됨)

 $eyear =  date("Y");
 $emonth = date("m") + 기간(월);
 $eday = date("d") - 1;

 $cedate = mktime(0,0,0,$emonth,$eday,$eyear);
 $endday=mktime(0,0,0,$emonth + 1,1,$eyear) - 1;  // 해당월의 마지막 일

if($cedate > $endday) $cedate = $endday;
 $edate = date('Y-m-d',$cedate);


 --  비교할것 --
http://beautipia.co.kr/zb/view.php?id=php&page=1&sn1=&divpage=1&sn=off&ss=on&sc=on&keyword=date_sub&select_arrange=headnum&desc=asc&no=64

댓글목록

등록된 댓글이 없습니다.

회원로그인

회원가입

  • 게시물이 없습니다.

접속자집계

오늘
1,868
어제
4,039
최대
6,642
전체
830,383
contact : webmaster@beautipia.co.kr
Copyright © beautipia.co.kr. All rights reserved.