=1 && $_GET['mth']<=12) || $_GET['mth']=="" ) && ($_GET['yr']>=1900 && $_GET['yr']<=2100)) { $dateYear = $_GET['yr']; if ($_GET['mth']=="") { $dateMonth="01"; } else { $dateMonth = $_GET['mth']; } } else { $dateYear = date("Y"); $dateMonth = date("m"); } $htmltitle="香港日曆及公眾假期 - ".date("Y\年n\月\份",mktime(0,0,0,$dateMonth,1,$dateYear));; ?> 星期日','星期一','星期二','星期三','星期四','星期五','星期六'); /* draw table */ $calendar = ''; /* table headings */ $calendar.= ''; } else if ($calsize=="s") { $calwidth=360; $headings = array('','一','二','三','四','五','六'); /* draw table */ $calendar = '
'.implode('',$headings).'
'; /* table headings */ $calendar.= ''; // prev month, next month $a_month=DOMAIN."information/calendar.php?".date("\y\\r\=Y\\&\m\\t\h\=m",mktime(0, 0, 0, $month, 1, $year)); } else { return $calendar; } /* days and weeks vars now ... */ $running_day = date('w',mktime(0,0,0,$month,1,$year)); $days_in_month = date('t',mktime(0,0,0,$month,1,$year)); $days_in_this_week = 1; $day_counter = 0; $dates_array = array(); /* row for week one */ $row_count=1; $calendar.= ''; /* print "blank" days until the first of the current week */ for($x = 0; $x < $running_day; $x++): $calendar.= ''; $days_in_this_week++; endfor; /* keep going with days.... */ for($list_day = 1; $list_day <= $days_in_month; $list_day++): // begin: lunar days if (!empty($lunar_days)) { $lunar_days_text = ""; if ($lunar_days[$year.$month.str_pad($list_day,2,"0",STR_PAD_LEFT)]!="") { $lunar_days_i = $lunar_days[$year.$month.str_pad($list_day,2,"0",STR_PAD_LEFT)]; } else { $lunar_days_i = substr($lunar_days_i,0,2).str_pad(substr($lunar_days_i,2,2) + 1,2,"0",STR_PAD_LEFT); } $lunar_days_text_1to2 = substr($lunar_days_i,0,2); $lunar_days_text_3to4 = substr($lunar_days_i,2,2); $lunar_days_text_4 = substr($lunar_days_i,3,1); if ($lunar_days_text_3to4=="01") { // the first day of each month if ($calsize=="l") { $lunar_days_text .= ""; } switch ($lunar_days_text_1to2) { case "01": $lunar_days_text .= "正月"; break; case "02": $lunar_days_text .= "二月"; break; case "03": $lunar_days_text .= "三月"; break; case "04": $lunar_days_text .= "四月"; break; case "X4": $lunar_days_text .= "潤四月"; break; case "05": $lunar_days_text .= "五月"; break; case "06": $lunar_days_text .= "六月"; break; case "07": $lunar_days_text .= "七月"; break; case "08": $lunar_days_text .= "八月"; break; case "09": $lunar_days_text .= "九月"; break; case "X9": $lunar_days_text .= "潤九月"; break; case "10": $lunar_days_text .= "十月"; break; case "11": $lunar_days_text .= "十一月"; break; case "12": $lunar_days_text .= "十二月"; break; default: break; } if ($calsize=="l") { $lunar_days_text .= ""; } } elseif ($lunar_days_text_3to4!="01") { // first character if ($calsize=="l") { $lunar_days_text .= ""; } if ($lunar_days_text_3to4 >=2 && $lunar_days_text_3to4 <=10 ) { $lunar_days_text .= "初"; } elseif ($lunar_days_text_3to4 >=11 && $lunar_days_text_3to4 <=19 ) { $lunar_days_text .= "十"; } elseif ($lunar_days_text_3to4 ==20) { $lunar_days_text .= "二"; } elseif ($lunar_days_text_3to4 >=21 && $lunar_days_text_3to4 <=29 ) { $lunar_days_text .= "廿"; } elseif ($lunar_days_text_3to4 ==30) { $lunar_days_text .= "三"; } elseif ($lunar_days_text_3to4 >=31 && $lunar_days_text_3to4 <=39 ) { $lunar_days_text .= "卅"; } // second character switch ($lunar_days_text_4) { case "1": $lunar_days_text.="一"; break; case "2": $lunar_days_text.="二"; break; case "3": $lunar_days_text.="三"; break; case "4": $lunar_days_text.="四"; break; case "5": $lunar_days_text.="五"; break; case "6": $lunar_days_text.="六"; break; case "7": $lunar_days_text.="七"; break; case "8": $lunar_days_text.="八"; break; case "9": $lunar_days_text.="九"; break; case "0": $lunar_days_text.="十"; break; default: break; } if ($calsize=="l") { $lunar_days_text .= ""; } } } // end: lunar days /* add in the day number */ if ($calsize=="l") { $calendar.= ''; if($running_day == 6): $calendar.= ''; if(($day_counter+1) != $days_in_month): $row_count+=1; $calendar.= ''; endif; $running_day = -1; $days_in_this_week = 0; endif; $days_in_this_week++; $running_day++; $day_counter++; endfor; /* finish the rest of the days in the week */ if($days_in_this_week < 8): for($x = 1; $x <= (8 - $days_in_this_week); $x++): $calendar.= ''; endfor; endif; while ($row_count<6) { $row_count++; $calendar.= ''. str_repeat("",7).''; } /* final row */ $calendar.= ''; /* end the table */ $calendar.= '
'.implode('',$headings).'
 0 || (date("D", mktime(0,0,0,$month,$list_day,$year)))=="Sun" ) { //$calendar.= ''.$list_day.''; $calendar.= '
'.$list_day.'
'; $calendar.= '
'.$lunar_days_text.'
'; $calendar.= '
'.$public_holiday_text." 
"; //} else if ($year.$month.str_pad($list_day,2,"0",STR_PAD_LEFT)==Date("Ymd")) { //$calendar.= '" style="background-color:#efefef">'; //$calendar.= '
'.$list_day.'
'; //$calendar.= '
'.$lunar_days_text.'
'; //$calendar.= '
今天 
'; } else { $calendar.= '
'.$list_day.'
'; $calendar.= '
'.$lunar_days_text.'
'; $calendar.= ' '; } } else if ($calsize=="s") { $calendar.= '
0 || (date("D", mktime(0,0,0,$month,$list_day,$year)))=="Sun" ) { $calendar.= ''.$list_day.'
'.$lunar_days_text.'
'; } else if ($year.$month.str_pad($list_day,2,"0",STR_PAD_LEFT)==Date("Ymd")) { $calendar.= ''.$list_day.'
'.$lunar_days_text.'
'; } else { $calendar.= ''.$list_day.'
'.$lunar_days_text.'
'; } } /** QUERY THE DATABASE FOR AN ENTRY FOR THIS DAY !! IF MATCHES FOUND, PRINT THEM !! **/ //$calendar.= str_repeat('

 

',2); $calendar.= '
 
 
'; /* all done, return result */ return $calendar; } /* sample usages */ $public_holiday = array(); $lunar_days = array(); // Year 2009 $public_holiday_2009 = array('20091225' => '聖誕節', '20091226' => '聖誕節後第一個周日'); $lunar_days_2009 = array('20091201' => '1015', '20091216' => '1101'); // Year 2010 $public_holiday_2010 = array('20100101' => '1月1日', '20100213' => '農曆年初一的前一日', '20100215' => '農曆年初二', '20100216' => '農曆年初三', '20100402' => '耶穌受難節', '20100403' => '耶穌受難節翌日', '20100405' => '復活節星期一', '20100406' => '清明節翌日', '20100501' => '勞動節', '20100521' => '佛誕', '20100616' => '端午節', '20100701' => '香港特別行政區成立紀念日', '20100923' => '中秋節翌日', '20101001' => '國慶日', '20101016' => '重陽節', '20101225' => '聖誕節', '20101227' => '聖誕節後第一個周日'); $lunar_days_2010 = array('20100101' => '1117', '20100115' => '1201', '20100201' => '1218', '20100214' => '0101', '20100301' => '0116', '20100316' => '0201', '20100401' => '0217', '20100414' => '0301', '20100501' => '0318', '20100514' => '0401', '20100601' => '0419', '20100612' => '0501', '20100701' => '0520', '20100712' => '0601', '20100801' => '0621', '20100810' => '0701', '20100901' => '0723', '20100908' => '0801', '20101001' => '0824', '20101008' => '0901', '20101101' => '0925', '20101106' => '1001', '20101201' => '1026', '20101206' => '1101' ); // Year 2011 $public_holiday_2011 = array('20110101' => '1月1日', '20110203' => '農曆年初一', '20110204' => '農曆年初二', '20110205' => '農曆年初三', '20110405' => '清明節', '20110422' => '耶穌受難節', '20110423' => '耶穌受難節翌日', '20110425' => '復活節星期一', '20110502' => '勞動節翌日', '20110510' => '佛誕', '20110606' => '端午節', '20110701' => '香港特別行政區成立紀念日', '20110913' => '中秋節翌日', '20111001' => '國慶日', '20111005' => '重陽節', '20111226' => '聖誕節後第一個周日', '20111227' => '聖誕節後第二個周日'); $lunar_days_2011 = array('20110101' => '1127', '20110104' => '1201', '20110201' => '1229', '20110203' => '0101', '20110301' => '0127', '20110305' => '0201', '20110401' => '0228', '20110403' => '0301', '20110501' => '0329', '20110503' => '0401', '20110601' => '0430', '20110602' => '0501', '20110701' => '0601', '20110731' => '0701', '20110801' => '0702', '20110829' => '0801', '20110901' => '0804', '20110927' => '0901', '20111001' => '0905', '20111027' => '1001', '20111101' => '1006', '20111125' => '1101', '20111201' => '1107', '20111225' => '1201' ); // Year 2012 $public_holiday_2012 = array('20120102' => '1月1日翌日', '20120123' => '農曆年初一', '20120124' => '農曆年初二', '20120125' => '農曆年初三', '20120404' => '清明節', '20120406' => '耶穌受難節', '20120407' => '耶穌受難節翌日', '20120409' => '復活節星期一', '20120428' => '佛誕', '20120501' => '勞動節', '20120623' => '端午節', '20120702' => '香港特別行政區成立紀念日翌日', '20121001' => '中秋節翌日', '20121002' => '國慶日翌日', '20121023' => '重陽節', '20121225' => '聖誕節', '20121226' => '聖誕節後第一個周日'); $lunar_days_2012 = array('20120101' => '1208', '20120123' => '0101', '20120201' => '0110', '20120222' => '0201', '20120301' => '0209', '20120322' => '0301', '20120401' => '0311', '20120421' => '0401', '20120501' => '0411', '20120521' => 'X401', '20120601' => 'X412', '20120619' => '0501', '20120701' => '0513', '20120719' => '0601', '20120801' => '0614', '20120817' => '0701', '20120901' => '0716', '20120916' => '0801', '20121001' => '0816', '20121015' => '0901', '20121101' => '0918', '20121114' => '1001', '20121201' => '1018', '20121213' => '1101'); // Year 2013 $public_holiday_2013 = array('20130101' => '1月1日', '20130211' => '農曆年初二', '20130212' => '農曆年初三', '20130213' => '農曆年初四', '20130329' => '耶穌受難節', '20130330' => '耶穌受難節翌日', '20130401' => '復活節星期一', '20130404' => '清明節', '20130501' => '勞動節', '20130517' => '佛誕', '20130612' => '端午節', '20130701' => '香港特別行政區成立紀念日', '20130920' => '中秋節翌日', '20131001' => '國慶日', '20131014' => '重陽節翌日', '20131225' => '聖誕節', '20131226' => '聖誕節後第一個周日'); $lunar_days_2013 = array('20130101' => '1120', '20130112' => '1201', '20130201' => '1221', '20130210' => '0101', '20130301' => '0120', '20130312' => '0201', '20130401' => '0221', '20130410' => '0301', '20130501' => '0322', '20130510' => '0401', '20130601' => '0423', '20130608' => '0501', '20130701' => '0524', '20130708' => '0601', '20130801' => '0625', '20130807' => '0701', '20130901' => '0726', '20130905' => '0801', '20131001' => '0827', '20131005' => '0901', '20131101' => '0928', '20131103' => '1001', '20131201' => '1029', '20131204' => '1101' ); // Year 2014 $public_holiday_2014 = array('20140101' => '1月1日', '20140131' => '農曆年初一', '20140201' => '農曆年初二', '20140203' => '農曆年初四', '20140405' => '清明節', '20140418' => '耶穌受難節', '20140419' => '耶穌受難節翌日', '20140421' => '復活節星期一', '20140501' => '勞動節', '20140506' => '佛誕', '20140602' => '端午節', '20140701' => '香港特別行政區成立紀念日', '20140909' => '中秋節翌日', '20141001' => '國慶日', '20141002' => '重陽節', '20141225' => '聖誕節', '20141226' => '聖誕節後第一個周日'); $lunar_days_2014 = array('20140101' => '1201', '20140131' => '0101', '20140201' => '0102', '20140301' => '0201', '20140331' => '0301', '20140401' => '0302', '20140429' => '0401', '20140501' => '0403', '20140529' => '0501', '20140601' => '0504', '20140627' => '0601', '20140701' => '0605', '20140727' => '0701', '20140801' => '0706', '20140825' => '0801', '20140901' => '0808', '20140924' => '0901', '20141001' => '0908', '20141024' => 'X901', '20141101' => '0909', '20141122' => '1001', '20141201' => '1010', '20141222' => '1101' ); ?>
香港日曆及公眾假期 -
"; // ---------------------------------------------- // begin: textlink // ---------------------------------------------- $adcode="TLINK"; include APP_PATH."spr/spr_ad_display.php"; // ---------------------------------------------- // end: textlink // ---------------------------------------------- ?>

">今天是 (星期)
$v) { if (substr($k,0,6)==$dateYear.$dateMonth) { $public_holiday_i++; if ($public_holiday_i==1) { echo "
香港公眾假期"; echo "

".$dateYear."年".ltrim($dateMonth,"0")."月份
"; } echo "
".intval(substr($k,4,2))."月".intval(substr($k,6,2))."日 (星期".weekday_chinese(Date("N",mktime(0,0,0,substr($k,4,2),substr($k,6,2),substr($k,0,4)))).") :  ".$v; } } } ?>
月份
公曆﹑農曆及公眾假期
   


上一個月 ()
  下一個月 ()


# 香港日暦由師奶網提供,如果錯漏,歡迎指正。