오늘은 대한입니다.
sun's longitude:299 44 13.36 
· 자유게시판 · 묻고답하기 · 알파문서 · RPMS list
· 사용자문서 · 팁/FAQ모음 · 리눅스Links · 자료실
· 서버정보 · 운영자 · Books/FAQ · FreeBSD
/board/read.php:소스보기  
알파문서
자주 잊어먹거나, 메모해 둘 필요성이 있는 팁이나 문서, 기타 등등
[*** 쓰기 금지단어 패턴 ***]
글 본문 중간에 업로드할 이미지를 추가하는 방법 : @@이미지이름@@
ex) @@foo.gif@@
202 번 글: [PHP] 해당 주(week)의 날짜 찾기
글쓴이: 산이 [홈페이지] 글쓴날: 2009년 04월 03일 19:40:17 금(저녁) 조회: 4058
[PHP] 해당 주(week)의 날짜 찾기

## find a day of the n'th week in month
## $n = 1'th week, 2nd week, . n'th week
## $w = Sunday(0), Monday(1), ... Saturday(6)
## default) find a day of the first week of sunday in this month
##
function day_of_week_in_month($n=1, $w=0, $month=0, $year=0)
{
  if($n < 1) $n = 1;
  if($w<0 || $w>6) $w = 0;
  if(!$month) $month = date('m');
  if(!$year) $year = date('Y');

  $week = date('w',mktime(1,0,0,$month,1,$year));
  $sunday = ($week==0) ? 1 : (8-$week); // day of first sunday

  $day = ($sunday+$w) + ($n-1)*7;

  return $day;
}

echo day_of_week_in_month(2,1); // 현재달의 두번째주 월(1)요일은 며칠?

 
이전글 : [JS] 자바스크립트 jquery
다음글 : [MySQL] my.cnf 튜닝 스크립트  
 from 114.111.62.248
JS(Redhands)Board 0.4 +@

|글쓰기| |답장쓰기| |수정| |삭제|
|이전글| |다음글| |목록보기|
인쇄용 

apache lighttpd linuxchannel.net 
Copyright 1997-2026. linuxchannel.net. All rights reserved.

Page loading: 0.01(server) + (network) + (browser) seconds