當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。