当前位置: 首页>>代码示例>>PHP>>正文


PHP easter_date函数代码示例

本文整理汇总了PHP中easter_date函数的典型用法代码示例。如果您正苦于以下问题:PHP easter_date函数的具体用法?PHP easter_date怎么用?PHP easter_date使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了easter_date函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: listOfHolidays

 /**
  * @return array
  */
 public function listOfHolidays()
 {
     $y = $this->datetime->format('Y');
     $d = 86400;
     $easter = easter_date($y);
     return ['brazil' => [date('d-m-Y', $easter), date('d-m-Y', $easter + 60 * $d), date('d-m-Y', $easter - 48 * $d), date('d-m-Y', $easter - 47 * $d), date('d-m-Y', $easter - 46 * $d), date('d-m-Y', $easter - 2 * $d), '01-01-' . $y, '21-04-' . $y, '01-05-' . $y, '07-09-' . $y, '12-10-' . $y, '02-11-' . $y, '15-11-' . $y, '24-12-' . $y, '25-12-' . $y, '31-12-' . $y]];
 }
开发者ID:gpupo,项目名称:common,代码行数:10,代码来源:Holidays.php

示例2: easterDates

 protected function easterDates() : array
 {
     $date = new DateTime(date('d-m-Y', easter_date($this->year)));
     $firstDay = $date->format('d-m');
     $date->modify('+1 day');
     $secondDay = $date->format('d-m');
     return [$firstDay, $secondDay];
 }
开发者ID:krystianzybala,项目名称:free-days,代码行数:8,代码来源:FreeDays.php

示例3: loadholidays

 public function loadholidays()
 {
     $year = date('Y');
     if (easter_date($year) < time()) {
         $year++;
     }
     return array('CHRISTIAN_EASTER' => '@' . easter_date($year));
 }
开发者ID:afischoff,项目名称:php-holiday-calculator,代码行数:8,代码来源:christian_holidays.php

示例4: isEasterDay

 public function isEasterDay($date)
 {
     $easterDay = date("Y-m-d", easter_date(date("Y")));
     if ($easterDay === $date) {
         return true;
     }
     return false;
 }
开发者ID:csibaud,项目名称:DeliveryDelay,代码行数:8,代码来源:ProductDelayHandler.php

示例5: calculateEaster

 public function calculateEaster()
 {
     $year = (string) $this->year;
     if ($year < 1970 or $year > 2037) {
         return alert('This app only works for years between 1970 and 2037', 'Invalid Date');
     }
     $date = date('l jS F Y \\W\\e\\e\\k\\: W', easter_date($year));
     $this->easter = $date;
 }
开发者ID:encorephp,项目名称:framework,代码行数:9,代码来源:MainController.php

示例6: buildEaster

    /**
     * special method to build events taking place relative to easter
     * 
     * @param Tx_CzSimpleCal_Utility_DateTime $start
     * @param Tx_CzSimpleCal_Utility_DateTime $end
     * @param Tx_CzSimpleCal_Utility_DateTime $until
     * @see http://de.php.net/manual/en/function.easter-days.php
     */
    protected function buildEaster($start, $end, $until)
    {
        if (!function_exists('easter_days') || !function_exists('easter_date')) {
            throw new RuntimeException('The function easter_days() or easter_date() is not available in your PHP installation.
				The binaries were probably not compiled using --enable-calendar. Contact your
				server administrator to fix this.');
        }
        /**
         * calculate the day offset 
         */
        /**
         * the day of the year of the date given as start
         * 0 is the 1st January
         * 
         * @var integer
         */
        $dayOfYear = date('z', $start->getTimestamp());
        $year = date('Y', $start->getTimestamp());
        $dayOfYearEaster = $this->getDayOfYearForEasterSunday($year);
        /**
         * a string for DateTime->modify() to jump from easter sunday
         * to the desired date
         * null if no jumping required
         * 
         * @var string|null
         */
        $diffDaysStart = $dayOfYear - $dayOfYearEaster;
        $diffDaysStart = sprintf('%+d days', $diffDaysStart);
        /**
         * a string for DateTime->modify() to jump from easter sunday
         * to the desired date
         * null if no jumping required
         * 
         * @var string|null
         */
        $diffDaysEnd = date('z', $end->getTimestamp()) - $dayOfYearEaster;
        $diffDaysEnd = sprintf('%+d days', $diffDaysEnd);
        while ($until >= $start) {
            $this->timeline->add(array('start' => $start->getTimestamp(), 'end' => $end->getTimestamp()));
            // calculate dates for the next year
            $year = $year + 1;
            /**
             * timestamp for easter sunday of a given year
             * @var integer
             */
            $easter = easter_date($year);
            $start->setDate($year, date('n', $easter), date('j', $easter));
            if (!is_null($diffDaysStart)) {
                $start->modify($diffDaysStart);
            }
            $end->setDate($year, date('n', $easter), date('j', $easter));
            if (!is_null($diffDaysEnd)) {
                $end->modify($diffDaysEnd);
            }
        }
    }
开发者ID:TYPO3-typo3org,项目名称:community,代码行数:64,代码来源:Yearly.php

示例7: calculaFeriadosMoveis

 private function calculaFeriadosMoveis($ano)
 {
     $pascoa = new DateTime();
     $pascoa->setTimestamp(easter_date($ano));
     $this->feriados['pascoa'] = $pascoa->format('d/m');
     $this->feriados['terca_carnaval'] = $pascoa->sub(new DateInterval('P47D'))->format('d/m');
     $this->feriados['quarta_cinzas'] = $pascoa->sub(new DateInterval('P46D'))->format('d/m');
     $this->feriados['sexta_santa'] = $pascoa->sub(new DateInterval('P2D'))->format('d/m');
     $this->feriados['corpus_christi'] = $pascoa->sub(new DateInterval('P60D'))->format('d/m');
 }
开发者ID:AmmonMa,项目名称:cake_extras,代码行数:10,代码来源:ContadorFeriadosBehavior.php

示例8: Holidays

 /**
  * @param $year
  * @return array
  */
 public static function Holidays($year)
 {
     $day = 86400;
     $dates = array();
     $dates['easter'] = easter_date($year);
     $dates['good_friday'] = $dates['easter'] - 2 * $day;
     $dates['carnival'] = $dates['easter'] - 47 * $day;
     $dates['corpus_christi'] = $dates['easter'] + 60 * $day;
     $holidays = array(Carbon::create($year, 1, 1)->format('Y-m-d'), date('Y-m-d', $dates['carnival']), date('Y-m-d', $dates['good_friday']), Carbon::create($year, 4, 21)->format('Y-m-d'), Carbon::create($year, 5, 1)->format('Y-m-d'), date('Y-m-d', $dates['corpus_christi']), Carbon::create($year, 9, 7)->format('Y-m-d'), Carbon::create($year, 10, 12)->format('Y-m-d'), Carbon::create($year, 11, 2)->format('Y-m-d'), Carbon::create($year, 11, 15)->format('Y-m-d'), Carbon::create($year, 11, 20)->format('Y-m-d'), Carbon::create($year, 12, 25)->format('Y-m-d'));
     return $holidays;
 }
开发者ID:bruno2c,项目名称:task-control,代码行数:15,代码来源:Date.php

示例9: feriados

 public static function feriados($ano = null)
 {
     $ano = empty($ano) ? (int) date('Y') : $ano;
     $datas = [];
     $datas['pascoa'] = easter_date($ano);
     $datas['sexta_santa'] = strtotime("-2 day", $datas['pascoa']);
     $datas['carnaval'] = strtotime("-47 day", $datas['pascoa']);
     $datas['corpus_cristi'] = strtotime("+60 day", $datas['pascoa']);
     $feriados = ['Ano Novo' => '01/01/' . $ano, 'Carnaval' => date('d/m/Y', $datas['carnaval']), 'Sexta-Feira Santa' => date('d/m/Y', $datas['sexta_santa']), 'P�scoa' => date('d/m/Y', $datas['pascoa']), 'Tiradentes' => '21/04/' . $ano, 'Dia do Trabalhador' => '01/05/' . $ano, 'Corpus Cristi' => date('d/m/Y', $datas['corpus_cristi']), 'Dia da Independ�ncia' => '07/09/' . $ano, 'Nossa Senhora de Aparecida' => '12/10/' . $ano, 'Dia de Finados' => '02/11/' . $ano, 'Proclama��o da Rep�blica' => '15/11/' . $ano, 'Natal' => '25/12/' . $ano];
     return $feriados;
 }
开发者ID:bruno-melo,项目名称:components,代码行数:11,代码来源:Date.php

示例10: feriados

 function feriados($ano, $posicao)
 {
     $dia = 86400;
     $datas = array();
     $datas['pascoa'] = easter_date($ano);
     $datas['sexta_santa'] = $datas['pascoa'] - 2 * $dia;
     $datas['carnaval'] = $datas['pascoa'] - 47 * $dia;
     $datas['corpus_christi'] = $datas['pascoa'] + 60 * $dia;
     $feriados = array('01/01', date('d/m', $datas['carnaval']), date('d/m', $datas['sexta_santa']), date('d/m', $datas['pascoa']), '21/04', '01/05', date('d/m', $datas['corpus_christi']), '12/10', '02/11', '15/11', '25/12');
     return $feriados[$posicao] . "/" . $ano;
 }
开发者ID:adrianomelo5,项目名称:magento,代码行数:11,代码来源:Boleto.php

示例11: est_ferie

 public static function est_ferie($jour)
 {
     $jour = date("Y-m-d", strtotime($jour));
     $annee = date("Y");
     $dimanche_paques = date("Y-m-d", easter_date($annee));
     $lundi_paques = date("Y-m-d", strtotime("{$dimanche_paques} +1 day"));
     $jeudi_ascension = date("Y-m-d", strtotime("{$dimanche_paques} +39 day"));
     $lundi_pentecote = date("Y-m-d", strtotime("{$dimanche_paques} +50 day"));
     $jours_feries = array($dimanche_paques, $lundi_paques, $jeudi_ascension, $lundi_pentecote, "{$annee}-01-01", "{$annee}-05-01", "{$annee}-05-08", "{$annee}-05-15", "{$annee}-07-14", "{$annee}-11-11", "{$annee}-11-01", "{$annee}-12-25");
     return in_array($jour, $jours_feries);
 }
开发者ID:InfoTeamUPS,项目名称:projetTarabel,代码行数:11,代码来源:Feries.php

示例12: holiday

 public function holiday($year, $pos)
 {
     $day = 86400;
     $dates = array();
     $dates['pascoa'] = easter_date($year);
     $dates['sexta_santa'] = $dates['pascoa'] - 2 * $day;
     $dates['carnaval'] = $dates['pascoa'] - 47 * $day;
     $dates['corpus_cristi'] = $dates['pascoa'] + 60 * $day;
     $holidays = array('01/01', date('d/m', $dates['carnaval']), date('d/m', $dates['sexta_santa']), date('d/m', $dates['pascoa']), '21/04', '01/05', date('d/m', $dates['corpus_cristi']), '7/09', '12/10', '02/11', '15/11', '25/12');
     return $holidays[$pos] . "/" . $year;
 }
开发者ID:luanmpereira,项目名称:default-store,代码行数:11,代码来源:functions.php

示例13: festivos

 public function festivos($ano = '')
 {
     $this->hoy = date('d/m/Y');
     if ($ano == '') {
         $ano = date('Y');
     }
     $this->ano = $ano;
     $this->pascua_mes = date("m", easter_date($this->ano));
     $this->pascua_dia = date("d", easter_date($this->ano));
     $this->festivos[$ano][1][1] = true;
     // Primero de Enero
     $this->festivos[$ano][5][1] = true;
     // Dia del Trabajo 1 de Mayo
     $this->festivos[$ano][7][20] = true;
     // Independencia 20 de Julio
     $this->festivos[$ano][8][7] = true;
     // Batalla de Boyacá 7 de Agosto
     $this->festivos[$ano][12][8] = true;
     // Maria Inmaculada 8 diciembre (religiosa)
     $this->festivos[$ano][12][25] = true;
     // Navidad 25 de diciembre
     $this->calcula_emiliani(1, 6);
     // Reyes Magos Enero 6
     $this->calcula_emiliani(3, 19);
     // San Jose Marzo 19
     $this->calcula_emiliani(6, 29);
     // San Pedro y San Pablo Junio 29
     $this->calcula_emiliani(8, 15);
     // Asunción Agosto 15
     $this->calcula_emiliani(10, 12);
     // Descubrimiento de América Oct 12
     $this->calcula_emiliani(11, 1);
     // Todos los santos Nov 1
     $this->calcula_emiliani(11, 11);
     // Independencia de Cartagena Nov 11
     //otras fechas calculadas a partir de la pascua.
     $this->otrasFechasCalculadas(-3);
     //jueves santo
     $this->otrasFechasCalculadas(-2);
     //viernes santo
     $this->otrasFechasCalculadas(36, true);
     //Ascención el Señor pascua
     $this->otrasFechasCalculadas(60, true);
     //Corpus Cristi
     $this->otrasFechasCalculadas(68, true);
     //Sagrado Corazón
     // otras fechas importantes que no son festivos
     // $this->otrasFechasCalculadas(-46);		// Miércoles de Ceniza
     // $this->otrasFechasCalculadas(-46);		// Miércoles de Ceniza
     // $this->otrasFechasCalculadas(-48);		// Lunes de Carnaval Barranquilla
     // $this->otrasFechasCalculadas(-47);		// Martes de Carnaval Barranquilla
 }
开发者ID:soydevcag,项目名称:ProductivityManager,代码行数:52,代码来源:festivos.php

示例14: getHolidays

function getHolidays($year = null)
{
    if ($year === null) {
        $year = intval(date('Y'));
    }
    $easterDate = easter_date($year);
    $easterDay = date('j', $easterDate);
    $easterMonth = date('n', $easterDate);
    $easterYear = date('Y', $easterDate);
    $holidays = array(mktime(0, 0, 0, 1, 1, $year), mktime(0, 0, 0, 5, 1, $year), mktime(0, 0, 0, 5, 8, $year), mktime(0, 0, 0, 7, 14, $year), mktime(0, 0, 0, 8, 15, $year), mktime(0, 0, 0, 11, 1, $year), mktime(0, 0, 0, 11, 11, $year), mktime(0, 0, 0, 12, 25, $year), mktime(0, 0, 0, $easterMonth, $easterDay + 1, $easterYear), mktime(0, 0, 0, $easterMonth, $easterDay + 39, $easterYear), mktime(0, 0, 0, $easterMonth, $easterDay + 50, $easterYear));
    sort($holidays);
    return $holidays;
}
开发者ID:JeromeDevome,项目名称:GRR,代码行数:13,代码来源:functions.inc.php

示例15: bhEasterDays

 protected function bhEasterDays()
 {
     $easter = new Date(easter_date($this->numeric("Y")));
     # Check if it's good friday
     if ($this->numeric("Ymd") === $easter->subDays(2)->numeric("Ymd")) {
         return true;
     }
     # Check if it's easter monday
     if ($this->numeric("Ymd") === $easter->addDays(1)->numeric("Ymd")) {
         return true;
     }
     return false;
 }
开发者ID:duncan3dc,项目名称:dates,代码行数:13,代码来源:BankHoliday.php


注:本文中的easter_date函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。