本文整理汇总了PHP中DateUtil::addDays方法的典型用法代码示例。如果您正苦于以下问题:PHP DateUtil::addDays方法的具体用法?PHP DateUtil::addDays怎么用?PHP DateUtil::addDays使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DateUtil
的用法示例。
在下文中一共展示了DateUtil::addDays方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parseDate
/**
* Helper method
*
* @param string input
* @param bool lower whether this is the lower boundary
* @return util.Date
*/
protected function parseDate($input, $lower)
{
switch ($input) {
case '__NOW__':
if ($lower) {
$r = DateUtil::getMidnight(Date::now());
} else {
$r = DateUtil::getMidnight(DateUtil::addDays(Date::now(), 1));
}
break;
case '__FUTURE__':
$r = Date::now();
break;
case '__UNLIMITED__':
$r = NULL;
break;
default:
$r = DateParser::parse($input);
}
return $r;
}
示例2: testNonLeapYear
public function testNonLeapYear()
{
$date = Date::create(1999, 2, 1, 0, 0, 0, new TimeZone('Europe/Berlin'));
$this->assertEquals(Date::create(1999, 3, 1, 0, 0, 0, new TimeZone('Europe/Berlin')), DateUtil::addMonths($date, 1));
$this->assertEquals(Date::create(1999, 3, 3, 0, 0, 0, new TimeZone('Europe/Berlin')), DateUtil::addDays($date, 30));
}
示例3: addWeeks
/**
* Adds a positive or negative amount of weeks
*
* @param util.Date date
* @param int count default 1
* @return util.Date
*/
public static function addWeeks(Date $date, $count = 1)
{
return DateUtil::addDays($date, $count * 7);
}
示例4: multipleResultForDoSelect
public function multipleResultForDoSelect()
{
$this->setResults(new MockResultSet(array(0 => array('job_id' => 1, 'title' => 'Unit tester', 'valid_from' => Date::now(), 'expire_at' => NULL), 1 => array('job_id' => 9, 'title' => 'PHP programmer', 'valid_from' => Date::now(), 'expire_at' => DateUtil::addDays(Date::now(), 7)))));
$peer = Job::getPeer();
$jobs = $peer->doSelect(new Criteria(array('job_id', 10, LESS_THAN)));
$this->assertArray($jobs);
$this->assertEquals(2, sizeof($jobs));
$this->assertClass($jobs[0], 'net.xp_framework.unittest.rdbms.dataset.Job');
$this->assertEquals(1, $jobs[0]->getJob_id());
$this->assertClass($jobs[1], 'net.xp_framework.unittest.rdbms.dataset.Job');
$this->assertEquals(9, $jobs[1]->getJob_id());
}