date()
// set the default timezone to use. Available since PHP 5.1 date_default_timezone_set('UTC'); // Prints something like: Monday echo date("l"); // Prints something like: Monday 8th of August 2005 03:12:46 PM echo date('l jS \of F Y h:i:s A'); // Prints: July 1, 2000 is on a Saturday echo "July 1, 2000 is on a " . date("l", mktime(0, 0, 0, 7, 1, 2000)); /* use the constants in the format parameter */ // prints something like: Mon, 15 Aug 2005 15:12:46 UTC echo date(DATE_RFC822); // prints something like: 2000-07-01T00:00:00+00:00 echo date(DATE_ATOM, mktime(0, 0, 0, 7, 1, 2000)); // prints something like: Wednesday the 15th echo date('l \t\h\e jS'); $tomorrow = mktime(0, 0, 0, date("m") , date("d")+1, date("Y")); $lastmonth = mktime(0, 0, 0, date("m")-1, date("d"), date("Y")); $nextyear = mktime(0, 0, 0, date("m"), date("d"), date("Y")+1); //To find last sunday for given date: last sunday : 2012-09-30 $day = '2012-10-04'; echo 'last sunday : '.date("Y-m-d",strtotime($day." last Sunday "));
'PHP' 카테고리의 다른 글
(함수) shuffle() & str_shuffle() - 랜덤함수 (0) | 2014.02.04 |
---|---|
(함수-정규식) preg_match() - 에디터 콘텐츠 이미지찾기 (0) | 2013.11.27 |
(함수) PHP5.3 Debug (0) | 2012.11.05 |
(함수) JS, CSS 소스 압축(줄바꿈, 들여쓰기, 주석 제거) (0) | 2012.10.12 |
(합수)define() - 해당페이지 직접 접근 제어 (0) | 2012.08.06 |