<i id='i3X6K'><tr id='i3X6K'><dt id='i3X6K'><q id='i3X6K'><span id='i3X6K'><b id='i3X6K'><form id='i3X6K'><ins id='i3X6K'></ins><ul id='i3X6K'></ul><sub id='i3X6K'></sub></form><legend id='i3X6K'></legend><bdo id='i3X6K'><pre id='i3X6K'><center id='i3X6K'></center></pre></bdo></b><th id='i3X6K'></th></span></q></dt></tr></i><div id='i3X6K'><tfoot id='i3X6K'></tfoot><dl id='i3X6K'><fieldset id='i3X6K'></fieldset></dl></div>
    <legend id='i3X6K'><style id='i3X6K'><dir id='i3X6K'><q id='i3X6K'></q></dir></style></legend>

    <small id='i3X6K'></small><noframes id='i3X6K'>

    1. <tfoot id='i3X6K'></tfoot>
          <bdo id='i3X6K'></bdo><ul id='i3X6K'></ul>

      1. 如何使用php获取假期日期

        how to get date for holidays using php(如何使用php获取假期日期)

          • <bdo id='QwvIR'></bdo><ul id='QwvIR'></ul>

            • <legend id='QwvIR'><style id='QwvIR'><dir id='QwvIR'><q id='QwvIR'></q></dir></style></legend>
                <tbody id='QwvIR'></tbody>
              <tfoot id='QwvIR'></tfoot>

              1. <i id='QwvIR'><tr id='QwvIR'><dt id='QwvIR'><q id='QwvIR'><span id='QwvIR'><b id='QwvIR'><form id='QwvIR'><ins id='QwvIR'></ins><ul id='QwvIR'></ul><sub id='QwvIR'></sub></form><legend id='QwvIR'></legend><bdo id='QwvIR'><pre id='QwvIR'><center id='QwvIR'></center></pre></bdo></b><th id='QwvIR'></th></span></q></dt></tr></i><div id='QwvIR'><tfoot id='QwvIR'></tfoot><dl id='QwvIR'><fieldset id='QwvIR'></fieldset></dl></div>

                <small id='QwvIR'></small><noframes id='QwvIR'>

                • 本文介绍了如何使用php获取假期日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  例如:

                  1. 一月的第三个星期一 马丁路德金纪念日
                  2. 2 月的第三个星期一 总统日(华盛顿诞辰)
                  3. 3 月的最后一个星期日 复活节
                  4. 5 月的最后一个星期一 阵亡将士纪念日
                  1. 3rd Monday of January for Martin Luther King Day
                  2. 3rd Monday of February for Presidents' Day (Washington's Birthday)
                  3. Last Sunday of March for Easter
                  4. Last Monday of May for Memorial Day

                  我正在尝试获取这些日期,这样我就可以在我的日历上标记它,而无需手动将未来几年的所有内容都放入.

                  I am trying to get these dates, so that I can mark it on my calendar without manually putting everything for the years to come.

                  修改答案!!

                  $curYir = date("Y");//current year
                  
                  $MLK = date('Y-m-d', strtotime("january $curYir third monday")); //marthin luthor king day
                  $PD = date('Y-m-d', strtotime("february $curYir third monday")); //presidents day
                  $Est =  date('Y-m-d', easter_date($curYir))); // easter 
                  $MDay = date('Y-m-d', strtotime("may $curYir first monday")); // memorial day
                  //("may $curYir last monday") will give you the last monday of may 1967
                  //much better to determine it by a loop
                        $eMDay = explode("-",$MDay);
                        $year = $eMDay[0];
                        $month = $eMDay[1];
                        $day = $eMDay[2];
                  
                        while($day <= 31){
                            $day = $day + 7;
                        }
                        if($day > 31)
                        $day = $day - 7;
                  
                        $MDay = $year.'-'.$month.'-'.$day;
                  $LD = date('Y-m-d', strtotime("september $curYir first monday"));  //labor day
                  $CD = date('Y-m-d', strtotime("october $curYir third monday")); //columbus day
                  $TH = date('Y-m-d', strtotime("november $curYir first thursday")); // thanks giving 
                  //("november $curYir last thursday") will give you the last thursday of november 1967
                  //much better to determine it by a loop
                        $eTH = explode("-",$TH);
                        $year = $eTH[0];
                        $month = $eTH[1];
                        $day = $eTH[2];
                  
                        while($day <= 30){
                            $day = $day + 7;
                        }
                        if($day > 30)
                        //watch out for the days in the month November only have 30
                        $day = $day - 7;
                  
                        $TH = $year.'-'.$month.'-'.$day;
                  

                  推荐答案

                  你可以利用php的这个功能.strtotime

                  You can leverage this function of php. strtotime

                  $currentYear = date("Y");
                  

                  MLK 日 -

                  echo date('Y-m-d', strtotime("third monday of january $currentYear"));
                  

                  总统日 -

                  echo date('Y-m-d', strtotime("third monday/OD February $currentYear"));
                  

                  复活节 -

                  echo date('Y-m-d', strtotime("last sunday of march $currentYear"));
                  

                  阵亡将士纪念日 -

                  echo date('Y-m-d', strtotime("last monday of may $currentYear"));
                  

                  这篇关于如何使用php获取假期日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)
                    <tbody id='66PX5'></tbody>
                  <tfoot id='66PX5'></tfoot>

                    <i id='66PX5'><tr id='66PX5'><dt id='66PX5'><q id='66PX5'><span id='66PX5'><b id='66PX5'><form id='66PX5'><ins id='66PX5'></ins><ul id='66PX5'></ul><sub id='66PX5'></sub></form><legend id='66PX5'></legend><bdo id='66PX5'><pre id='66PX5'><center id='66PX5'></center></pre></bdo></b><th id='66PX5'></th></span></q></dt></tr></i><div id='66PX5'><tfoot id='66PX5'></tfoot><dl id='66PX5'><fieldset id='66PX5'></fieldset></dl></div>
                    <legend id='66PX5'><style id='66PX5'><dir id='66PX5'><q id='66PX5'></q></dir></style></legend>
                        <bdo id='66PX5'></bdo><ul id='66PX5'></ul>

                        <small id='66PX5'></small><noframes id='66PX5'>