├── .gitignore
├── README.md
├── index.php
├── function.php
├── api.php
├── LICENSE
├── Lunar.class.php
└── config.php
/.gitignore:
--------------------------------------------------------------------------------
1 | HolidayApi.clpprj
2 | HolidayApi_clcs.csprj
3 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # HolidayApi
2 | 节假日api
3 |
4 |
5 | > 运行index.php
6 |
7 | * demo
8 |
9 | ~~DEMO~~
10 |
11 | 服务器有点小贵,不再续费了。有需要可以自行搭建。
12 |
13 | * 返回json
14 |
15 | ```
16 | [
17 | {
18 | "date":"2017-10-05",
19 | "code":1,
20 | "info":"节假日",
21 | "describe":
22 | {
23 | "Time":"10月1日",
24 | "Name":"国庆节",
25 | "EnglishName":"National Day",
26 | "IsNotWork":1,
27 | "Start":0,
28 | "End":7
29 | }
30 | }
31 | ]
32 | ```
33 |
34 | * 说明
35 |
36 | ```
37 | code = 0
38 | 工作日:周一至周五
39 | code = 1
40 | 节假日
41 | code = 2
42 | 双休日:周六周日
43 | ```
44 |
45 | * 功能
46 |
47 | ```
48 | 加入节假日时间段,节假日不放假
49 | 1.节假日当天前后几天能放假的都算节假日
50 | 如:10.1国庆节,但是放假7天,所以10.1-10.7都算节假日
51 | 2.有些节日不放假,算工作日
52 | 如:2.2世界湿地日,但是不放假,所以算工作日
53 | ```
54 |
55 | * TODO
56 |
57 | ```
58 | 节假日叠加问题
59 | 因为国庆节和中秋节重叠,使得2017.10.8也属于节假日
60 | ```
61 |
--------------------------------------------------------------------------------
/index.php:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 | 节假日api
10 |
11 |
12 |
47 |
49 |
50 |
51 |
52 |
58 |
59 | 判断某个时间是否是节假日
60 |
61 |
62 |
74 |
75 |
76 |
77 | 接口地址:
78 | api.php?date=
79 |
80 | 日期
81 |
82 |
83 | demo1:
84 |
85 | api.php?date=
86 |
87 |
88 | demo2:
89 | 选择日期:
90 |
91 |
92 |
93 |
94 |
95 |
96 |
116 |
117 |
--------------------------------------------------------------------------------
/function.php:
--------------------------------------------------------------------------------
1 | 第m个 week=>星期n
36 | */
37 | function GetWeekNumberByDate($time = 0)
38 | {
39 | $time == 0 and $time = time();
40 |
41 | $return = [];
42 | $day = date('d',$time) - 1;
43 | $return['week'] = (date('w',strtotime(date('Y-m-01',$time))) + $day % 7) % 7;
44 | $return['number'] = floor($day / 7) + 1;
45 | $return['chineseNumber'] = '第'.Number2ChineseNumber($return['number']).'个';
46 | if($day + 1 + 7 >= date('t',$time))
47 | {
48 | $return['lastWeek'] = 1;
49 | }
50 | return $return;
51 | }
52 | function Number2ChineseNumber($number = -1)
53 | {
54 | ($number == -1 || $number > 10) and $number = 0;
55 | $chineseNumber = ["零","一","二","三","四","五","六","七","八","九","十"];
56 | return $chineseNumber[$number];
57 | }
58 | function ChineseNumber2Number($number = '零')
59 | {
60 | $chineseNumber = ["零","一","二","三","四","五","六","七","八","九","十"];
61 | !in_array($number,$chineseNumber) and $number = '零';
62 | $chineseNumber = array_flip($chineseNumber);
63 | return $chineseNumber[$number];
64 | }
65 | /**
66 | * 星期中文转数字
67 | * @param undefined $week
68 | *
69 | * @return int 星期数字
70 | */
71 | function WeekChinese2Number($week = '日')
72 | {
73 | $weekChineses = ["日","一","二","三","四","五","六"];
74 | $weekChineses = array_flip($weekChineses);
75 | !in_array($week,$weekChineses) and $week = '日';
76 | return $weekChineses[$week];
77 | }
78 | /**
79 | * 星期数字转中文
80 | *
81 | * @param int $weekNumber 星期数字
82 | * @param string $weekPrefix 中文星期前缀 [周|星期]
83 | *
84 | * @return string 中文星期
85 | */
86 | function WeekNumber2Chinese($weekNumber = 0,$weekPrefix = "周")
87 | {
88 | $weekChineses = ["日","一","二","三","四","五","六"];
89 | ($weekNumber < 0 || $weekNumber > count($weekChineses)) and $weekNumber = 0;
90 | return $weekPrefix.$weekChineses[$weekNumber];
91 | }
92 | function LMonName($month)
93 | {
94 | $month == "腊" and $month = "十二";
95 | $Name = array(1=>"正","二","三","四","五","六","七","八","九","十","十一","十二");
96 | $Name = array_flip($Name);
97 | return $Name[$month];
98 | }
99 |
100 | function LDayName($day)
101 | {
102 | $Name = array(1=>
103 | "初一","初二","初三","初四","初五","初六","初七","初八","初九","初十",
104 | "十一","十二","十三","十四","十五","十六","十七","十八","十九","二十",
105 | "廿一","廿二","廿三","廿四","廿五","廿六","廿七","廿八","廿九","三十"
106 | );
107 | $Name = array_flip($Name);
108 | return $Name[$day];
109 | }
110 |
--------------------------------------------------------------------------------
/api.php:
--------------------------------------------------------------------------------
1 | -1,
21 | 'info'=>'输入日期',
22 | 'describe'=>[],
23 | ],JSON_UNESCAPED_UNICODE));
24 |
25 | $dates = $_GET['date'];
26 | $dates == "" and $dates = date('Y-m-d',time());
27 |
28 | $lunar = new Lunar();
29 |
30 | $return = [];
31 | foreach(explode(',',$dates) as $key => $date)
32 | {
33 | //不正确的日期格式
34 | if(($time = strtotime($date)) === FALSE)
35 | {
36 | exit('不正确的日期格式:'.$date);
37 | }
38 |
39 | $oldDate = $date;
40 | $date = date('Y-m-d',$time);
41 | //返回的格式
42 | $return[$key]['date'] = $date;
43 | //工作日
44 | $return[$key]['code'] = 0;
45 | $return[$key]['info'] = '工作日';
46 | $return[$key]['describe'] = ['Name'=>'周一至周五'];
47 | //判断是否为阳历节假日
48 | foreach($GregorianCalendarHoliday as $GregorianCalendarHolidayList)
49 | {
50 | //time
51 | $time = $GregorianCalendarHolidayList["Time"];
52 | $time = date('Y-',strtotime($oldDate)).str_replace(array('月','日'),array('-',''),$time);
53 | $time = strtotime($time);
54 | //start end
55 | $start= $time - abs($GregorianCalendarHolidayList["Start"]) * 86400;
56 | $end = $time + abs($GregorianCalendarHolidayList["End"]) * 86400;
57 | //判断
58 | if(strtotime($date) >= $start && strtotime($date) <= $end)
59 | {
60 | //节假日
61 | if($GregorianCalendarHolidayList["IsNotWork"])
62 | {
63 | $return[$key]['code'] = 1;
64 | $return[$key]['info'] = '节假日';
65 | }
66 | $return[$key]['describe'] = $GregorianCalendarHolidayList;
67 | break;
68 | }
69 | }
70 | //判断是否为特殊节假日
71 | foreach($SpecialHoliday as $SpecialHolidaylist)
72 | {
73 | //time
74 | $time = $SpecialHolidaylist["Time"];
75 | preg_match('/^(.*)月(.*)星期(.*)$/iUs',$time,$match);
76 | if(!isset($match[2]))
77 | {
78 | break;
79 | }
80 | if($match[2] == "最后一个")
81 | {
82 | $match[2] = 7;
83 | }
84 | $gdwnm = GetDateByWeekNumberOfMonth(strtotime($oldDate),$match[2],WeekChinese2Number($match[3]));
85 | if(date('m',$gdwnm) != date('m',strtotime($date)))
86 | {
87 | $match[2] = 6;
88 | $gdwnm = GetDateByWeekNumberOfMonth(strtotime($oldDate),$match[2],WeekChinese2Number($match[3]));
89 | }
90 | $time = $gdwnm;
91 | //start end
92 | $start= $time - abs($SpecialHolidaylist["Start"]) * 86400;
93 | $end = $time + abs($SpecialHolidaylist["End"]) * 86400;
94 | //判断
95 | if(strtotime($date) >= $start && strtotime($date) <= $end)
96 | {
97 | //节假日
98 | if($SpecialHolidaylist["IsNotWork"])
99 | {
100 | $return[$key]['code'] = 1;
101 | $return[$key]['info'] = '节假日';
102 | }
103 | $return[$key]['describe'] = $SpecialHolidaylist;
104 | break;
105 | }
106 | }
107 | //判断是否为阴历节假日
108 | foreach($LunarCalendarHoliday as $LunarCalendarHolidayList)
109 | {
110 | //time
111 | $time = $LunarCalendarHolidayList["Time"];
112 | $time = explode('月',$time);
113 | //农历转数字
114 | $y = date('Y',strtotime($date));
115 | $LunarCalendarHolidayList["Name"] == '除夕' and $y--;//除夕是上一年的阴历日期
116 | $time = $lunar->convertLunarToSolar($y,LMonName($time[0]),LDayName($time[1]));
117 | $time = strtotime(implode('-',$time));
118 | //start end
119 | $start= $time - abs($LunarCalendarHolidayList["Start"]) * 86400;
120 | $end = $time + abs($LunarCalendarHolidayList["End"]) * 86400;
121 | //判断
122 | if(strtotime($date) >= $start && strtotime($date) <= $end)
123 | {
124 | //节假日
125 | if($LunarCalendarHolidayList["IsNotWork"])
126 | {
127 | $return[$key]['code'] = 1;
128 | $return[$key]['info'] = '节假日';
129 | }
130 | $return[$key]['describe'] = $LunarCalendarHolidayList;
131 | break;
132 | }
133 | }
134 | //不是节假日,则判断是否为非工作日(周六周日)
135 | if($return[$key]['code'] == 0)
136 | {
137 | //星期
138 | $w = date('w',strtotime($date));
139 | if($w == 0 || $w == 6)
140 | {
141 | //双休日
142 | $return[$key]['code'] = 2;
143 | $return[$key]['info'] = '双休日';
144 | $return[$key]['describe'] = ['Name'=>'周六周日'];
145 | }
146 | }
147 | }
148 | echo json_encode($return,JSON_UNESCAPED_UNICODE);
149 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "{}"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright {yyyy} {name of copyright owner}
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------
/Lunar.class.php:
--------------------------------------------------------------------------------
1 | lunarInfo[$year - $this->MIN_YEAR];
20 | if($year == $this->MIN_YEAR && $month <= 2 && $date <= 9)
21 | {
22 | return array(1891,'正月','初一','辛卯',1,1,'兔');
23 | }
24 | return $this->getLunarByBetween($year,$this->getDaysBetweenSolar($year,$month,$date,$yearData[1],$yearData[2]));
25 | }
26 | /**
27 | * 将阴历转换为阳历
28 | * @param year 阴历-年
29 | * @param month 阴历-月,闰月处理:例如如果当年闰五月,那么第二个五月就传六月,相当于阴历有13个月,只是有的时候第13个月的天数为0
30 | * @param date 阴历-日
31 | */
32 | function convertLunarToSolar($year,$month,$date)
33 | {
34 | $yearData = $this->lunarInfo[$year - $this->MIN_YEAR];
35 | $between = $this->getDaysBetweenLunar($year,$month,$date);
36 | $res = mktime(0,0,0,$yearData[1],$yearData[2],$year);
37 | $res = date('Y-m-d',$res + $between * 24 * 60 * 60);
38 | return explode('-',$res);
39 | }
40 | /**
41 | * 判断是否是闰年
42 | * @param year
43 | */
44 | function isLeapYear($year)
45 | {
46 | return (($year % 4 == 0 && $year % 100 != 0) || ($year % 400 == 0));
47 | }
48 | /**
49 | * 获取干支纪年
50 | * @param year
51 | */
52 | function getLunarYearName($year)
53 | {
54 | $sky = array('庚','辛','壬','癸','甲','乙','丙','丁','戊','己');
55 | $earth = array('申','酉','戌','亥','子','丑','寅','卯','辰','巳','午','未');
56 |
57 | $year = $year.'';
58 | return $sky[$year{3}].$earth[$year % 12];
59 | }
60 | /**
61 | * 根据阴历年获取生肖
62 | * @param year 阴历年
63 | */
64 | function getYearZodiac($year)
65 | {
66 | $zodiac = array('猴','鸡','狗','猪','鼠','牛','虎','兔','龙','蛇','马','羊');
67 | return $zodiac[$year % 12];
68 | }
69 | /**
70 | * 获取阳历月份的天数
71 | * @param year 阳历-年
72 | * @param month 阳历-月
73 | */
74 | function getSolarMonthDays($year,$month)
75 | {
76 | $monthHash = array('1' =>31,'2' =>$this->isLeapYear($year)?29:28,'3' =>31,'4' =>30,'5' =>31,'6' =>30,'7' =>31,'8' =>31,'9' =>30,'10'=>31,'11'=>30,'12'=>31);
77 | return $monthHash[$month];
78 | }
79 | /**
80 | * 获取阴历月份的天数
81 | * @param year 阴历-年
82 | * @param month 阴历-月,从一月开始
83 | */
84 | function getLunarMonthDays($year,$month)
85 | {
86 | $monthData = $this->getLunarMonths($year);
87 | return $monthData[$month - 1];
88 | }
89 | /**
90 | * 获取阴历每月的天数的数组
91 | * @param year
92 | */
93 | function getLunarMonths($year)
94 | {
95 | $yearData = $this->lunarInfo[$year - $this->MIN_YEAR];
96 | $leapMonth= $yearData[0];
97 | $bit = decbin($yearData[3]);
98 | for($i = 0; $i < strlen($bit);$i ++)
99 | {
100 | $bitArray[$i] = substr($bit, $i, 1);
101 | }
102 | for($k = 0,$klen = 16 - count($bitArray);$k < $klen;$k++)
103 | {
104 | array_unshift($bitArray, '0');
105 | }
106 | $bitArray = array_slice($bitArray,0,($leapMonth == 0?12:13));
107 | for($i = 0; $i < count($bitArray); $i++)
108 | {
109 | $bitArray[$i] = $bitArray[$i] + 29;
110 | }
111 | return $bitArray;
112 | }
113 | /**
114 | * 获取农历每年的天数
115 | * @param year 农历年份
116 | */
117 | function getLunarYearDays($year)
118 | {
119 | $yearData = $this->lunarInfo[$year - $this->MIN_YEAR];
120 | $monthArray = $this->getLunarYearMonths($year);
121 | $len = count($monthArray);
122 | return ($monthArray[$len - 1] == 0?$monthArray[$len - 2]:$monthArray[$len - 1]);
123 | }
124 | function getLunarYearMonths($year)
125 | {
126 | //debugger;
127 | $monthData = $this->getLunarMonths($year);
128 | $res = array();
129 | $temp = 0;
130 | $yearData = $this->lunarInfo[$year - $this->MIN_YEAR];
131 | $len = ($yearData[0] == 0?12:13);
132 | for($i = 0;$i < $len;$i++)
133 | {
134 | $temp = 0;
135 | for($j = 0;$j <= $i;$j++)
136 | {
137 | $temp += $monthData[$j];
138 | }
139 | array_push($res, $temp);
140 | }
141 | return $res;
142 | }
143 | /**
144 | * 获取闰月
145 | * @param year 阴历年份
146 | */
147 | function getLeapMonth($year)
148 | {
149 | $yearData = $this->lunarInfo[$year - $this->MIN_YEAR];
150 | return $yearData[0];
151 | }
152 | /**
153 | * 计算阴历日期与正月初一相隔的天数
154 | * @param year
155 | * @param month
156 | * @param date
157 | */
158 | function getDaysBetweenLunar($year,$month,$date)
159 | {
160 | $yearData = $this->lunarInfo[$year - $this->MIN_YEAR];
161 | $leapMonth = $yearData[0];
162 | //fix bug (issues 3) by zhusaidong:如果闰月在搜索时间之前则要再加一个月的天数
163 | //这个修复同时修复了(issues 1)的bug,故,(issues 1)的修复代码已注释
164 | $leapMonth > 0 and $leapMonth <= $month and $month++;
165 |
166 | $yearMonth = $this->getLunarMonths($year);
167 | $res = 0;
168 | for($i = 1;$i < $month;$i++)
169 | {
170 | $res += $yearMonth[$i - 1];
171 | }
172 | //fix bug (issues 1) by zhusaidong:如果有闰月则加上闰月天数
173 | //该bug被(issues 3)修复,故,已注释
174 | //$month == 12 and count($yearMonth) == 13 and $res += $yearMonth[12];
175 | $res += $date - 1;
176 | return $res;
177 | }
178 | /**
179 | * 计算2个阳历日期之间的天数
180 | * @param year 阳历年
181 | * @param cmonth
182 | * @param cdate
183 | * @param dmonth 阴历正月对应的阳历月份
184 | * @param ddate 阴历初一对应的阳历天数
185 | */
186 | function getDaysBetweenSolar($year,$cmonth,$cdate,$dmonth,$ddate)
187 | {
188 | $a = mktime(0,0,0,$cmonth,$cdate,$year);
189 | $b = mktime(0,0,0,$dmonth,$ddate,$year);
190 | return ceil(($a - $b) / 24 / 3600);
191 | }
192 | /**
193 | * 根据距离正月初一的天数计算阴历日期
194 | * @param year 阳历年
195 | * @param between 天数
196 | */
197 | function getLunarByBetween($year,$between)
198 | {
199 | //debugger;
200 | $lunarArray = array();
201 | $yearMonth = array();
202 | $t = 0;
203 | $e = 0;
204 | $leapMonth = 0;
205 | $m = '';
206 | if($between == 0)
207 | {
208 | array_push($lunarArray, $year,'正月','初一');
209 | $t = 1;
210 | $e = 1;
211 | }
212 | else
213 | {
214 | $year = $between > 0? $year : ($year - 1);
215 | $yearMonth = $this->getLunarYearMonths($year);
216 | $leapMonth = $this->getLeapMonth($year);
217 | $between = $between > 0?$between : ($this->getLunarYearDays($year) + $between);
218 | for($i = 0;$i < 13;$i++)
219 | {
220 | if($between == $yearMonth[$i])
221 | {
222 | $t = $i + 2;
223 | $e = 1;
224 | break;
225 | }
226 | else
227 | if($between < $yearMonth[$i])
228 | {
229 | $t = $i + 1;
230 | $e = $between - (empty($yearMonth[$i - 1])?0:$yearMonth[$i - 1]) + 1;
231 | break;
232 | }
233 | }
234 | $m = ($leapMonth != 0 && $t == $leapMonth + 1)?('闰'.$this->getCapitalNum($t - 1,true)):$this->getCapitalNum(($leapMonth != 0 && $leapMonth + 1 < $t?($t - 1):$t),true);
235 | array_push($lunarArray,$year,$m,$this->getCapitalNum($e,false));
236 | }
237 | array_push($lunarArray,$this->getLunarYearName($year));//天干地支
238 | array_push($lunarArray,$t,$e);
239 | array_push($lunarArray,$this->getYearZodiac($year));//12生肖
240 | array_push($lunarArray,$leapMonth);//闰几月
241 | return $lunarArray;
242 | }
243 | /**
244 | * 获取数字的阴历叫法
245 | * @param num 数字
246 | * @param isMonth 是否是月份的数字
247 | */
248 | function getCapitalNum($num,$isMonth)
249 | {
250 | $isMonth = $isMonth || false;
251 | $dateHash = array('0' =>'','1' =>'一','2' =>'二','3' =>'三','4' =>'四','5' =>'五','6' =>'六','7' =>'七','8' =>'八','9' =>'九','10'=>'十 ');
252 | $monthHash = array('0' =>'','1' =>'正月','2' =>'二月','3' =>'三月','4' =>'四月','5' =>'五月','6' =>'六月','7' =>'七月','8' =>'八月','9' =>'九月','10'=>'十月','11'=>'冬月','12'=>'腊月');
253 | $res = '';
254 |
255 | if($isMonth)
256 | {
257 | $res = $monthHash[$num];
258 | }
259 | else
260 | {
261 | if($num <= 10)
262 | {
263 | $res = '初'.$dateHash[$num];
264 | }
265 | else
266 | if($num > 10 && $num < 20)
267 | {
268 | $res = '十'.$dateHash[$num - 10];
269 | }
270 | else
271 | if($num == 20)
272 | {
273 | $res = "二十";
274 | }
275 | else
276 | if($num > 20 && $num < 30)
277 | {
278 | $res = "廿".$dateHash[$num - 20];
279 | }
280 | else
281 | if($num == 30)
282 | {
283 | $res = "三十";
284 | }
285 | }
286 | return $res;
287 | }
288 | }
289 |
--------------------------------------------------------------------------------
/config.php:
--------------------------------------------------------------------------------
1 | 时间,
6 | * Name =>中文名称,
7 | * EnglishName =>英文名称,
8 | * IsNotWork =>是否不工作(是否放假,有些节日不放假),
9 | * Start =>放假开始时间(-1则提前一天放假),
10 | * End =>放假结束时间(+1则延后一天放假)
11 | * )
12 | * 总放假天数:|Start|+|End|+1
13 | *
14 | * @author zhusaidong [zhusaidong@gmail.com]
15 | * @version 0.2.0.0
16 | */
17 | const NotWork = 1;
18 | const Work = 0;
19 | //阳历
20 | $GregorianCalendarHoliday = array(
21 | array(
22 | "Time" => "1月1日",
23 | "Name" => "中国元旦",
24 | "EnglishName" => "New Year's Day",
25 | "IsNotWork" => NotWork,
26 | "Start" => 0,
27 | "End" => 0,
28 | ),
29 | array(
30 | "Time" => "2月2日",
31 | "Name" => "世界湿地日",
32 | "EnglishName" => "World Wetlands Day",
33 | "IsNotWork" => Work,
34 | "Start" => 0,
35 | "End" => 0,
36 | ),
37 | array(
38 | "Time" => "2月14日",
39 | "Name" => "情人节",
40 | "EnglishName" => "Valentine's Day",
41 | "IsNotWork" => Work,
42 | "Start" => 0,
43 | "End" => 0,
44 | ),
45 | array(
46 | "Time" => "3月3日",
47 | "Name" => "全国爱耳日",
48 | "EnglishName" => "",
49 | "IsNotWork" => Work,
50 | "Start" => 0,
51 | "End" => 0,
52 | ),
53 | array(
54 | "Time" => "3月5日",
55 | "Name" => "青年志愿者服务日",
56 | "EnglishName" => "",
57 | "IsNotWork" => Work,
58 | "Start" => 0,
59 | "End" => 0,
60 | ),
61 | array(
62 | "Time" => "3月8日",
63 | "Name" => "国际妇女节",
64 | "EnglishName" => "International Women' Day",
65 | "IsNotWork" => Work,
66 | "Start" => 0,
67 | "End" => 0,
68 | ),
69 | array(
70 | "Time" => "3月9日",
71 | "Name" => "保护母亲河日",
72 | "EnglishName" => "",
73 | "IsNotWork" => Work,
74 | "Start" => 0,
75 | "End" => 0,
76 | ),
77 | array(
78 | "Time" => "3月12日",
79 | "Name" => "中国植树节",
80 | "EnglishName" => "China Arbor Day",
81 | "IsNotWork" => Work,
82 | "Start" => 0,
83 | "End" => 0,
84 | ),
85 | array(
86 | "Time" => "3月14日",
87 | "Name" => "白色情人节",
88 | "EnglishName" => "White Day",
89 | "IsNotWork" => Work,
90 | "Start" => 0,
91 | "End" => 0,
92 | ),
93 | array(
94 | "Time" => "3月14日",
95 | "Name" => "国际警察日",
96 | "EnglishName" => "International Policemen' Day",
97 | "IsNotWork" => Work,
98 | "Start" => 0,
99 | "End" => 0,
100 | ),
101 | array(
102 | "Time" => "3月15日",
103 | "Name" => "世界消费者权益日",
104 | "EnglishName" => "World Consumer Right Day",
105 | "IsNotWork" => Work,
106 | "Start" => 0,
107 | "End" => 0,
108 | ),
109 | array(
110 | "Time" => "3月21日",
111 | "Name" => "世界森林日",
112 | "EnglishName" => "World Forest Day",
113 | "IsNotWork" => Work,
114 | "Start" => 0,
115 | "End" => 0,
116 | ),
117 | array(
118 | "Time" => "3月21日",
119 | "Name" => "世界睡眠日",
120 | "EnglishName" => "World Sleep Day",
121 | "IsNotWork" => Work,
122 | "Start" => 0,
123 | "End" => 0,
124 | ),
125 | array(
126 | "Time" => "3月22日",
127 | "Name" => "世界水日",
128 | "EnglishName" => "World Water Day",
129 | "IsNotWork" => Work,
130 | "Start" => 0,
131 | "End" => 0,
132 | ),
133 | array(
134 | "Time" => "3月23日",
135 | "Name" => "世界气象日",
136 | "EnglishName" => "World Meteorological Day",
137 | "IsNotWork" => Work,
138 | "Start" => 0,
139 | "End" => 0,
140 | ),
141 | array(
142 | "Time" => "3月24日",
143 | "Name" => "世界防治结核病日",
144 | "EnglishName" => "World Tuberculosis Day",
145 | "IsNotWork" => Work,
146 | "Start" => 0,
147 | "End" => 0,
148 | ),
149 | array(
150 | "Time" => "4月1日",
151 | "Name" => "愚人节",
152 | "EnglishName" => "April Fools' Day",
153 | "IsNotWork" => Work,
154 | "Start" => 0,
155 | "End" => 0,
156 | ),
157 | array(
158 | "Time" => "4月5日",
159 | "Name" => "清明节",
160 | "EnglishName" => "Tomb",
161 | "IsNotWork" => NotWork,
162 | "Start" => 0,
163 | "End" => 0,
164 | ),
165 | array(
166 | "Time" => "4月7日",
167 | "Name" => "世界卫生日",
168 | "EnglishName" => "World Health Day",
169 | "IsNotWork" => Work,
170 | "Start" => 0,
171 | "End" => 0,
172 | ),
173 | array(
174 | "Time" => "4月22日",
175 | "Name" => "世界地球日",
176 | "EnglishName" => "World Earth Day",
177 | "IsNotWork" => Work,
178 | "Start" => 0,
179 | "End" => 0,
180 | ),
181 | array(
182 | "Time" => "4月26日",
183 | "Name" => "世界知识产权日",
184 | "EnglishName" => "World Intellectual Property Day",
185 | "IsNotWork" => Work,
186 | "Start" => 0,
187 | "End" => 0,
188 | ),
189 | array(
190 | "Time" => "5月1日",
191 | "Name" => "国际劳动节",
192 | "EnglishName" => "International Labour Day",
193 | "IsNotWork" => NotWork,
194 | "Start" => 0,
195 | "End" => 0,
196 | ),
197 | array(
198 | "Time" => "5月3日",
199 | "Name" => "世界哮喘日",
200 | "EnglishName" => "World Asthma Day",
201 | "IsNotWork" => Work,
202 | "Start" => 0,
203 | "End" => 0,
204 | ),
205 | array(
206 | "Time" => "5月4日",
207 | "Name" => "中国青年节",
208 | "EnglishName" => "Chinese Youth Day",
209 | "IsNotWork" => Work,
210 | "Start" => 0,
211 | "End" => 0,
212 | ),
213 | array(
214 | "Time" => "5月8日",
215 | "Name" => "世界红十字日",
216 | "EnglishName" => "World Red",
217 | "IsNotWork" => Work,
218 | "Start" => 0,
219 | "End" => 0,
220 | ),
221 | array(
222 | "Time" => "5月12日",
223 | "Name" => "国际护士节",
224 | "EnglishName" => "International Nurse Day",
225 | "IsNotWork" => Work,
226 | "Start" => 0,
227 | "End" => 0,
228 | ),
229 | array(
230 | "Time" => "5月15日",
231 | "Name" => "国际家庭日",
232 | "EnglishName" => "International Family Day",
233 | "IsNotWork" => Work,
234 | "Start" => 0,
235 | "End" => 0,
236 | ),
237 | array(
238 | "Time" => "5月17日",
239 | "Name" => "世界电信日",
240 | "EnglishName" => "World Telecommunications Day",
241 | "IsNotWork" => Work,
242 | "Start" => 0,
243 | "End" => 0,
244 | ),
245 | array(
246 | "Time" => "5月20日",
247 | "Name" => "全国学生营养日",
248 | "EnglishName" => "",
249 | "IsNotWork" => Work,
250 | "Start" => 0,
251 | "End" => 0,
252 | ),
253 | array(
254 | "Time" => "5月23日",
255 | "Name" => "国际牛奶日",
256 | "EnglishName" => "International Milk Day",
257 | "IsNotWork" => Work,
258 | "Start" => 0,
259 | "End" => 0,
260 | ),
261 | array(
262 | "Time" => "5月31日",
263 | "Name" => "世界无烟日",
264 | "EnglishName" => "World No",
265 | "IsNotWork" => Work,
266 | "Start" => 0,
267 | "End" => 0,
268 | ),
269 | array(
270 | "Time" => "6月1日",
271 | "Name" => "国际儿童节",
272 | "EnglishName" => "International Children's Day",
273 | "IsNotWork" => Work,
274 | "Start" => 0,
275 | "End" => 0,
276 | ),
277 | array(
278 | "Time" => "6月5日",
279 | "Name" => "世界环境日",
280 | "EnglishName" => "International Environment Day",
281 | "IsNotWork" => Work,
282 | "Start" => 0,
283 | "End" => 0,
284 | ),
285 | array(
286 | "Time" => "6月6日",
287 | "Name" => "全国爱眼日",
288 | "EnglishName" => "",
289 | "IsNotWork" => Work,
290 | "Start" => 0,
291 | "End" => 0,
292 | ),
293 | array(
294 | "Time" => "6月17日",
295 | "Name" => "世界防治荒漠化和干旱日",
296 | "EnglishName" => "World Day to combat desertification",
297 | "IsNotWork" => Work,
298 | "Start" => 0,
299 | "End" => 0,
300 | ),
301 | array(
302 | "Time" => "6月23日",
303 | "Name" => "国际奥林匹克日",
304 | "EnglishName" => "International Olympic Day",
305 | "IsNotWork" => Work,
306 | "Start" => 0,
307 | "End" => 0,
308 | ),
309 | array(
310 | "Time" => "6月25日",
311 | "Name" => "全国土地日",
312 | "EnglishName" => "",
313 | "IsNotWork" => Work,
314 | "Start" => 0,
315 | "End" => 0,
316 | ),
317 | array(
318 | "Time" => "6月26日",
319 | "Name" => "国际禁毒日",
320 | "EnglishName" => "International Day Against Drug Abuse and Illicit Trafficking",
321 | "IsNotWork" => Work,
322 | "Start" => 0,
323 | "End" => 0,
324 | ),
325 | array(
326 | "Time" => "7月1日",
327 | "Name" => "建党节",
328 | "EnglishName" => "Anniversary of the Founding of the Chinese Communist Party",
329 | "IsNotWork" => Work,
330 | "Start" => 0,
331 | "End" => 0,
332 | ),
333 | array(
334 | "Time" => "7月1日",
335 | "Name" => "国际建筑日",
336 | "EnglishName" => "International Architecture Day",
337 | "IsNotWork" => Work,
338 | "Start" => 0,
339 | "End" => 0,
340 | ),
341 | array(
342 | "Time" => "7月7日",
343 | "Name" => "中国人民抗日战争纪念日",
344 | "EnglishName" => "",
345 | "IsNotWork" => Work,
346 | "Start" => 0,
347 | "End" => 0,
348 | ),
349 | array(
350 | "Time" => "7月11日",
351 | "Name" => "世界人口日",
352 | "EnglishName" => "World Population Day",
353 | "IsNotWork" => Work,
354 | "Start" => 0,
355 | "End" => 0,
356 | ),
357 | array(
358 | "Time" => "8月1日",
359 | "Name" => "建军节",
360 | "EnglishName" => "Army Day",
361 | "IsNotWork" => Work,
362 | "Start" => 0,
363 | "End" => 0,
364 | ),
365 | array(
366 | "Time" => "8月12日",
367 | "Name" => "国际青年节",
368 | "EnglishName" => "International Youth Day",
369 | "IsNotWork" => Work,
370 | "Start" => 0,
371 | "End" => 0,
372 | ),
373 | array(
374 | "Time" => "9月8日",
375 | "Name" => "国际扫盲日",
376 | "EnglishName" => "International Anti",
377 | "IsNotWork" => Work,
378 | "Start" => 0,
379 | "End" => 0,
380 | ),
381 | array(
382 | "Time" => "9月10日",
383 | "Name" => "中国教师节",
384 | "EnglishName" => "Teacher's Day",
385 | "IsNotWork" => Work,
386 | "Start" => 0,
387 | "End" => 0,
388 | ),
389 | array(
390 | "Time" => "9月16日",
391 | "Name" => "中国脑健康日",
392 | "EnglishName" => "",
393 | "IsNotWork" => Work,
394 | "Start" => 0,
395 | "End" => 0,
396 | ),
397 | array(
398 | "Time" => "9月16日",
399 | "Name" => "国际臭氧层保护日",
400 | "EnglishName" => "International Day for the Preservation of the Ozone Layer",
401 | "IsNotWork" => Work,
402 | "Start" => 0,
403 | "End" => 0,
404 | ),
405 | array(
406 | "Time" => "9月20日",
407 | "Name" => "全国爱牙日",
408 | "EnglishName" => "",
409 | "IsNotWork" => Work,
410 | "Start" => 0,
411 | "End" => 0,
412 | ),
413 | array(
414 | "Time" => "9月21日",
415 | "Name" => "世界停火日",
416 | "EnglishName" => "World Cease",
417 | "IsNotWork" => Work,
418 | "Start" => 0,
419 | "End" => 0,
420 | ),
421 | array(
422 | "Time" => "9月27日",
423 | "Name" => "世界旅游日",
424 | "EnglishName" => "World Tourism Day",
425 | "IsNotWork" => Work,
426 | "Start" => 0,
427 | "End" => 0,
428 | ),
429 | array(
430 | "Time" => "10月1日",
431 | "Name" => "国庆节",
432 | "EnglishName" => "National Day",
433 | "IsNotWork" => NotWork,
434 | "Start" => 0,
435 | "End" => 6,
436 | ),
437 | array(
438 | "Time" => "10月1日",
439 | "Name" => "国际音乐日",
440 | "EnglishName" => "International Music Day",
441 | "IsNotWork" => Work,
442 | "Start" => 0,
443 | "End" => 0,
444 | ),
445 | array(
446 | "Time" => "10月1日",
447 | "Name" => "国际老年人日",
448 | "EnglishName" => "International Day of Older Persons",
449 | "IsNotWork" => Work,
450 | "Start" => 0,
451 | "End" => 0,
452 | ),
453 | array(
454 | "Time" => "10月4日",
455 | "Name" => "世界动物日",
456 | "EnglishName" => "World Animal Day",
457 | "IsNotWork" => Work,
458 | "Start" => 0,
459 | "End" => 0,
460 | ),
461 | array(
462 | "Time" => "10月5日",
463 | "Name" => "世界教师日",
464 | "EnglishName" => "World Teachers' Day",
465 | "IsNotWork" => Work,
466 | "Start" => 0,
467 | "End" => 0,
468 | ),
469 | array(
470 | "Time" => "10月8日",
471 | "Name" => "全国高血压日",
472 | "EnglishName" => "",
473 | "IsNotWork" => Work,
474 | "Start" => 0,
475 | "End" => 0,
476 | ),
477 | array(
478 | "Time" => "10月9日",
479 | "Name" => "世界邮政日",
480 | "EnglishName" => "World Post Day",
481 | "IsNotWork" => Work,
482 | "Start" => 0,
483 | "End" => 0,
484 | ),
485 | array(
486 | "Time" => "10月10日",
487 | "Name" => "世界精神卫生日",
488 | "EnglishName" => "World Mental Health Day",
489 | "IsNotWork" => Work,
490 | "Start" => 0,
491 | "End" => 0,
492 | ),
493 | array(
494 | "Time" => "10月14日",
495 | "Name" => "世界标准日",
496 | "EnglishName" => "World Standards Day",
497 | "IsNotWork" => Work,
498 | "Start" => 0,
499 | "End" => 0,
500 | ),
501 | array(
502 | "Time" => "10月15日",
503 | "Name" => "国际盲人节",
504 | "EnglishName" => "International Day of the Blind",
505 | "IsNotWork" => Work,
506 | "Start" => 0,
507 | "End" => 0,
508 | ),
509 | array(
510 | "Time" => "10月15日",
511 | "Name" => "世界农村妇女日",
512 | "EnglishName" => "World Rural Women's Day",
513 | "IsNotWork" => Work,
514 | "Start" => 0,
515 | "End" => 0,
516 | ),
517 | array(
518 | "Time" => "10月16日",
519 | "Name" => "世界粮食日",
520 | "EnglishName" => "World Food Day",
521 | "IsNotWork" => Work,
522 | "Start" => 0,
523 | "End" => 0,
524 | ),
525 | array(
526 | "Time" => "10月17日",
527 | "Name" => "国际消除贫困日",
528 | "EnglishName" => "International Day for the Eradication of Poverty",
529 | "IsNotWork" => Work,
530 | "Start" => 0,
531 | "End" => 0,
532 | ),
533 | array(
534 | "Time" => "10月24日",
535 | "Name" => "联合国日",
536 | "EnglishName" => "United Nations Day",
537 | "IsNotWork" => Work,
538 | "Start" => 0,
539 | "End" => 0,
540 | ),
541 | array(
542 | "Time" => "10月24日",
543 | "Name" => "世界发展新闻日",
544 | "EnglishName" => "World Development Information Day",
545 | "IsNotWork" => Work,
546 | "Start" => 0,
547 | "End" => 0,
548 | ),
549 | array(
550 | "Time" => "10月28日",
551 | "Name" => "中国男性健康日",
552 | "EnglishName" => "",
553 | "IsNotWork" => Work,
554 | "Start" => 0,
555 | "End" => 0,
556 | ),
557 | array(
558 | "Time" => "10月29日",
559 | "Name" => "国际生物多样性日",
560 | "EnglishName" => "International Biodiversity Day",
561 | "IsNotWork" => Work,
562 | "Start" => 0,
563 | "End" => 0,
564 | ),
565 | array(
566 | "Time" => "10月31日",
567 | "Name" => "万圣节",
568 | "EnglishName" => "Halloween",
569 | "IsNotWork" => Work,
570 | "Start" => 0,
571 | "End" => 0,
572 | ),
573 | array(
574 | "Time" => "11月8日",
575 | "Name" => "中国记者节",
576 | "EnglishName" => "",
577 | "IsNotWork" => Work,
578 | "Start" => 0,
579 | "End" => 0,
580 | ),
581 | array(
582 | "Time" => "11月9日",
583 | "Name" => "消防宣传日",
584 | "EnglishName" => "",
585 | "IsNotWork" => Work,
586 | "Start" => 0,
587 | "End" => 0,
588 | ),
589 | array(
590 | "Time" => "11月14日",
591 | "Name" => "世界糖尿病日",
592 | "EnglishName" => "World Diabetes Day",
593 | "IsNotWork" => Work,
594 | "Start" => 0,
595 | "End" => 0,
596 | ),
597 | array(
598 | "Time" => "11月17日",
599 | "Name" => "国际大学生节",
600 | "EnglishName" => "",
601 | "IsNotWork" => Work,
602 | "Start" => 0,
603 | "End" => 0,
604 | ),
605 | array(
606 | "Time" => "11月25日",
607 | "Name" => "国际消除对妇女的暴力日",
608 | "EnglishName" => "International Day For the elimination of Violence against Women",
609 | "IsNotWork" => Work,
610 | "Start" => 0,
611 | "End" => 0,
612 | ),
613 | array(
614 | "Time" => "12月1日",
615 | "Name" => "世界爱滋病日",
616 | "EnglishName" => "World AIDS Day",
617 | "IsNotWork" => Work,
618 | "Start" => 0,
619 | "End" => 0,
620 | ),
621 | array(
622 | "Time" => "12月3日",
623 | "Name" => "世界残疾人日",
624 | "EnglishName" => "World Disabled Day",
625 | "IsNotWork" => Work,
626 | "Start" => 0,
627 | "End" => 0,
628 | ),
629 | array(
630 | "Time" => "12月4日",
631 | "Name" => "全国法制宣传日",
632 | "EnglishName" => "",
633 | "IsNotWork" => Work,
634 | "Start" => 0,
635 | "End" => 0,
636 | ),
637 | array(
638 | "Time" => "12月9日",
639 | "Name" => "世界足球日",
640 | "EnglishName" => "World Football Day",
641 | "IsNotWork" => Work,
642 | "Start" => 0,
643 | "End" => 0,
644 | ),
645 | array(
646 | "Time" => "12月25日",
647 | "Name" => "圣诞节",
648 | "EnglishName" => "Christmas Day",
649 | "IsNotWork" => Work,
650 | "Start" => 0,
651 | "End" => 0,
652 | ),
653 | array(
654 | "Time" => "12月29日",
655 | "Name" => "国际生物多样性日",
656 | "EnglishName" => "International Biological Diversity Day",
657 | "IsNotWork" => Work,
658 | "Start" => 0,
659 | "End" => 0,
660 | ),
661 | );
662 | //特殊阳历
663 | $SpecialHoliday = array(
664 | array(
665 | "Time" => "1月最后一个星期日",
666 | "Name" => "国际麻风节",
667 | "EnglishName" => "",
668 | "IsNotWork" => Work,
669 | "Start" => 0,
670 | "End" => 0,
671 | ),
672 | array(
673 | "Time" => "3月最后一个完整周的星期一",
674 | "Name" => "中小学生安全教育日",
675 | "EnglishName" => "",
676 | "IsNotWork" => Work,
677 | "Start" => 0,
678 | "End" => 0,
679 | ),
680 | array(
681 | "Time" => "5月第二个星期日",
682 | "Name" => "母亲节",
683 | "EnglishName" => "Mother's Day",
684 | "IsNotWork" => Work,
685 | "Start" => 0,
686 | "End" => 0,
687 | ),
688 | array(
689 | "Time" => "5月第三个星期日",
690 | "Name" => "全国助残日",
691 | "EnglishName" => "",
692 | "IsNotWork" => Work,
693 | "Start" => 0,
694 | "End" => 0,
695 | ),
696 | array(
697 | "Time" => "6月第三个星期日",
698 | "Name" => "父亲节",
699 | "EnglishName" => "Father's Day",
700 | "IsNotWork" => Work,
701 | "Start" => 0,
702 | "End" => 0,
703 | ),
704 | array(
705 | "Time" => "9月第三个星期二",
706 | "Name" => "国际和平日",
707 | "EnglishName" => "International Peace Day",
708 | "IsNotWork" => Work,
709 | "Start" => 0,
710 | "End" => 0,
711 | ),
712 | array(
713 | "Time" => "9月第三个星期六",
714 | "Name" => "全国国防教育日",
715 | "EnglishName" => "",
716 | "IsNotWork" => Work,
717 | "Start" => 0,
718 | "End" => 0,
719 | ),
720 | array(
721 | "Time" => "9月第四个星期日",
722 | "Name" => "国际聋人节",
723 | "EnglishName" => "International Day of the Deaf",
724 | "IsNotWork" => Work,
725 | "Start" => 0,
726 | "End" => 0,
727 | ),
728 | array(
729 | "Time" => "10月第一个星期一",
730 | "Name" => "世界住房日",
731 | "EnglishName" => "World Habitat Day",
732 | "IsNotWork" => Work,
733 | "Start" => 0,
734 | "End" => 0,
735 | ),
736 | array(
737 | "Time" => "10月第二个星斯一",
738 | "Name" => "加拿大感恩节",
739 | "EnglishName" => "Thanksgiving Day",
740 | "IsNotWork" => Work,
741 | "Start" => 0,
742 | "End" => 0,
743 | ),
744 | array(
745 | "Time" => "10月第二个星期三",
746 | "Name" => "国际减轻自然灾害日",
747 | "EnglishName" => "International Day for Natural Disaster Reduction",
748 | "IsNotWork" => Work,
749 | "Start" => 0,
750 | "End" => 0,
751 | ),
752 | array(
753 | "Time" => "10月第二个星期四",
754 | "Name" => "世界爱眼日",
755 | "EnglishName" => "World Sight Day",
756 | "IsNotWork" => Work,
757 | "Start" => 0,
758 | "End" => 0,
759 | ),
760 | array(
761 | "Time" => "11月最后一个星期四",
762 | "Name" => "美国感恩节",
763 | "EnglishName" => "Thanksgiving Day",
764 | "IsNotWork" => NotWork,
765 | "Start" => 0,
766 | "End" => 0,
767 | ),
768 | );
769 | //阴历
770 | $LunarCalendarHoliday = array(
771 | array(
772 | "Time" => "正月初一",
773 | "Name" => "春节",
774 | "EnglishName" => "the Spring Festival",
775 | "IsNotWork" => NotWork,
776 | "Start" => 0,
777 | "End" => 6,
778 | ),
779 | array(
780 | "Time" => "正月十五",
781 | "Name" => "元宵节",
782 | "EnglishName" => "Lantern Festival",
783 | "IsNotWork" => Work,
784 | "Start" => 0,
785 | "End" => 0,
786 | ),
787 | array(
788 | "Time" => "五月初五",
789 | "Name" => "端午节",
790 | "EnglishName" => "the Dragon-Boat Festival",
791 | "IsNotWork" => NotWork,
792 | "Start" => 0,
793 | "End" => 0,
794 | ),
795 | array(
796 | "Time" => "七月初七",
797 | "Name" => "乞巧节",
798 | "EnglishName" => "Double-Seventh Day",
799 | "IsNotWork" => Work,
800 | "Start" => 0,
801 | "End" => 0,
802 | ),
803 | array(
804 | "Time" => "八月十五",
805 | "Name" => "中秋节",
806 | "EnglishName" => "the Mid-Autumn Festival",
807 | "IsNotWork" => NotWork,
808 | "Start" => 0,
809 | "End" => 0,
810 | ),
811 | array(
812 | "Time" => "九月初九",
813 | "Name" => "重阳节",
814 | "EnglishName" => "the Double Ninth Festival",
815 | "IsNotWork" => Work,
816 | "Start" => 0,
817 | "End" => 0,
818 | ),
819 | array(
820 | "Time" => "腊月初八",
821 | "Name" => "腊八节",
822 | "EnglishName" => "the laba Rice Porridge Festival",
823 | "IsNotWork" => Work,
824 | "Start" => 0,
825 | "End" => 0,
826 | ),
827 | array(
828 | "Time" => "十二月三十",
829 | "Name" => "除夕",
830 | "EnglishName" => "New Year's Eve",
831 | "IsNotWork" => NotWork,
832 | "Start" => 0,
833 | "End" => 0,
834 | ),
835 | );
836 |
--------------------------------------------------------------------------------