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


PHP TTDate::getDateOfNextDayOfMonth方法代码示例

本文整理汇总了PHP中TTDate::getDateOfNextDayOfMonth方法的典型用法代码示例。如果您正苦于以下问题:PHP TTDate::getDateOfNextDayOfMonth方法的具体用法?PHP TTDate::getDateOfNextDayOfMonth怎么用?PHP TTDate::getDateOfNextDayOfMonth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TTDate的用法示例。


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

示例1: preSave

 function preSave()
 {
     if ($this->getFrequency() == 40) {
         if (TTDate::getDayOfMonth($this->getStartDate()) > 28) {
             Debug::text(' Start Date is After the 28th, making the 28th: ', __FILE__, __LINE__, __METHOD__, 10);
             $this->setStartDate(TTDate::getDateOfNextDayOfMonth($this->getStartDate(), strtotime('28-Feb-05')));
         }
     }
     if ($this->getType() == 10) {
         //If amount isn't set, but Rate and units are, calc amount for them.
         if (($this->getAmount() == NULL or $this->getAmount() == 0 or $this->getAmount() == '') and $this->getRate() !== NULL and $this->getUnits() !== NULL and $this->getRate() != 0 and $this->getUnits() != 0 and $this->getRate() != '' and $this->getUnits() != '') {
             $this->setAmount(bcmul($this->getRate(), $this->getUnits(), 4));
         }
     }
     if ($this->isNew() == TRUE) {
         $this->first_insert = TRUE;
     }
     return TRUE;
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:19,代码来源:RecurringPayStubAmendmentFactory.class.php

示例2: getNextPayPeriod


//.........这里部分代码省略.........
                 //rather moving back to the Monday.
                 if (TTDate::getDayOfMonth($tmp_pay_period_end_date) != TTDate::getDayOfMonth($tmp_pay_period_end_date + 1)) {
                     Debug::text('Right on day boundary, minus an additional second to account for difference...', __FILE__, __LINE__, __METHOD__, 10);
                     $tmp_pay_period_end_date--;
                 }
             }
             Debug::text('aTmp Pay Period End Date: ' . TTDate::getDate('DATE+TIME', $tmp_pay_period_end_date) . ' (' . $tmp_pay_period_end_date . ')', __FILE__, __LINE__, __METHOD__, 10);
             $start_date = $tmp_pay_period_end_date + 1;
             if ($this->getType() == 10) {
                 //Weekly
                 $tmp_pay_period_end_date = TTDate::getMiddleDayEpoch($start_date) + 86400 * 7;
                 //Add one week
             } elseif ($this->getType() == 20) {
                 //Bi-Weekly
                 $tmp_pay_period_end_date = TTDate::getMiddleDayEpoch($start_date) + 86400 * 14;
                 //Add two weeks
             }
             //Use Begin Day Epoch to nullify DST issues.
             $end_date = TTDate::getBeginDayEpoch($tmp_pay_period_end_date) - 1;
             $transaction_date = TTDate::getMiddleDayEpoch(TTDate::getMiddleDayEpoch($end_date) + $this->getTransactionDate() * 86400);
             break;
         case 30:
             //Semi-monthly
             $tmp_last_pay_period_end_day_of_month = TTDate::getDayOfMonth($last_pay_period_end_date + 1);
             Debug::text('bLast Pay Period End Day Of Month: ' . $tmp_last_pay_period_end_day_of_month, __FILE__, __LINE__, __METHOD__, 10);
             if ($tmp_last_pay_period_end_day_of_month == $this->convertLastDayOfMonth($this->getPrimaryDayOfMonth())) {
                 $insert_pay_period = 1;
                 $primary = TRUE;
             } elseif ($tmp_last_pay_period_end_day_of_month == $this->convertLastDayOfMonth($this->getSecondaryDayOfMonth())) {
                 $insert_pay_period = 2;
                 $primary = FALSE;
             } else {
                 Debug::text('Finding if Primary or Secondary is closest...', __FILE__, __LINE__, __METHOD__, 10);
                 $primary_date_offset = TTDate::getDateOfNextDayOfMonth($last_pay_period_end_date, NULL, $this->convertLastDayOfMonth($this->getPrimaryDayOfMonth())) - $last_pay_period_end_date;
                 $secondary_date_offset = TTDate::getDateOfNextDayOfMonth($last_pay_period_end_date, NULL, $this->convertLastDayOfMonth($this->getSecondaryDayOfMonth())) - $last_pay_period_end_date;
                 Debug::text('Primary Date Offset: ' . TTDate::getDays($primary_date_offset) . ' Secondary Date Offset: ' . TTDate::getDays($secondary_date_offset), __FILE__, __LINE__, __METHOD__, 10);
                 if ($primary_date_offset <= $secondary_date_offset) {
                     $insert_pay_period = 1;
                     $primary = TRUE;
                     $last_pay_period_end_date = TTDate::getDateOfNextDayOfMonth($last_pay_period_end_date, NULL, $this->convertLastDayOfMonth($this->getPrimaryDayOfMonth()));
                 } else {
                     $insert_pay_period = 2;
                     $primary = FALSE;
                     $last_pay_period_end_date = TTDate::getDateOfNextDayOfMonth($last_pay_period_end_date, NULL, $this->convertLastDayOfMonth($this->getSecondaryDayOfMonth()));
                 }
                 $last_pay_period_end_date = TTDate::getBeginDayEpoch($last_pay_period_end_date);
             }
             unset($tmp_last_pay_period_end_day_of_month);
             Debug::text('cLast Pay Period End Date: ' . TTDate::getDate('DATE+TIME', $last_pay_period_end_date) . ' (' . $last_pay_period_end_date . ') Primary: ' . (int) $primary, __FILE__, __LINE__, __METHOD__, 10);
             $start_date = $last_pay_period_end_date + 1;
             if ($primary == TRUE) {
                 $end_date = TTDate::getBeginDayEpoch(TTDate::getDateOfNextDayOfMonth($start_date, NULL, $this->convertLastDayOfMonth($this->getSecondaryDayOfMonth()))) - 1;
                 $transaction_date = TTDate::getMiddleDayEpoch(TTDate::getDateOfNextDayOfMonth(TTDate::getMiddleDayEpoch($end_date), NULL, $this->convertLastDayOfMonth($this->getPrimaryTransactionDayOfMonth())));
             } else {
                 $end_date = TTDate::getBeginDayEpoch(TTDate::getDateOfNextDayOfMonth($start_date, NULL, $this->convertLastDayOfMonth($this->getPrimaryDayOfMonth()))) - 1;
                 $transaction_date = TTDate::getMiddleDayEpoch(TTDate::getDateOfNextDayOfMonth(TTDate::getMiddleDayEpoch($end_date), NULL, $this->convertLastDayOfMonth($this->getSecondaryTransactionDayOfMonth())));
             }
             break;
         case 50:
             //Monthly
             $start_date = $last_pay_period_end_date + 1;
             $end_date = TTDate::getDateOfNextDayOfMonth($start_date + 86400, NULL, $this->convertLastDayOfMonth($this->getPrimaryDayOfMonth()));
             //Use Begin Day Epoch to nullify DST issues.
             $end_date = TTDate::getBeginDayEpoch(TTDate::getBeginMinuteEpoch($end_date)) - 1;
             $transaction_date = TTDate::getMiddleDayEpoch(TTDate::getDateOfNextDayOfMonth($end_date, NULL, $this->convertLastDayOfMonth($this->getPrimaryTransactionDayOfMonth())));
             break;
开发者ID:J-P-Hanafin,项目名称:TimeTrex-1,代码行数:67,代码来源:PayPeriodScheduleFactory.class.php

示例3: test_getDateOfNextDayOfMonth

 function test_getDateOfNextDayOfMonth()
 {
     Debug::text('Testing Date Format: Y-m-d', __FILE__, __LINE__, __METHOD__, 10);
     TTDate::setDateFormat('Y-m-d');
     TTDate::setTimeZone('PST');
     TTDate::setTimeFormat('g:i A');
     $this->assertEquals(TTDate::getDateOfNextDayOfMonth(strtotime('01-Dec-06'), strtotime('02-Dec-06')), strtotime('02-Dec-06'));
     $this->assertEquals(TTDate::getDateOfNextDayOfMonth(strtotime('14-Dec-06'), strtotime('23-Nov-06')), strtotime('23-Dec-06'));
     $this->assertEquals(TTDate::getDateOfNextDayOfMonth(strtotime('14-Dec-06'), strtotime('13-Dec-06')), strtotime('13-Jan-07'));
     $this->assertEquals(TTDate::getDateOfNextDayOfMonth(strtotime('14-Dec-06'), strtotime('14-Dec-06')), strtotime('14-Dec-06'));
     $this->assertEquals(TTDate::getDateOfNextDayOfMonth(strtotime('12-Dec-06'), strtotime('01-Dec-04')), strtotime('01-Jan-07'));
     $this->assertEquals(TTDate::getDateOfNextDayOfMonth(strtotime('12-Dec-06'), NULL, 1), strtotime('01-Jan-07'));
     $this->assertEquals(TTDate::getDateOfNextDayOfMonth(strtotime('12-Dec-06'), NULL, 12), strtotime('12-Dec-06'));
     $this->assertEquals(TTDate::getDateOfNextDayOfMonth(strtotime('12-Dec-06'), NULL, 31), strtotime('31-Dec-06'));
     $this->assertEquals(TTDate::getDateOfNextDayOfMonth(strtotime('01-Feb-07'), NULL, 31), strtotime('28-Feb-07'));
     $this->assertEquals(TTDate::getDateOfNextDayOfMonth(strtotime('01-Feb-08'), NULL, 29), strtotime('29-Feb-08'));
     $this->assertEquals(TTDate::getDateOfNextDayOfMonth(strtotime('01-Feb-08'), NULL, 31), strtotime('29-Feb-08'));
     //Anchor Epoch: 09-Apr-04 11:59 PM PDT Day Of Month Epoch:  Day Of Month: 24<br>
     $this->assertEquals(TTDate::getDateOfNextDayOfMonth(strtotime('09-Apr-04'), NULL, 24), strtotime('24-Apr-04'));
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:20,代码来源:DateTimeTest.php


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