本文整理汇总了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;
}
示例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;
示例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'));
}