本文整理汇总了PHP中w2p_Utilities_Date::duplicate方法的典型用法代码示例。如果您正苦于以下问题:PHP w2p_Utilities_Date::duplicate方法的具体用法?PHP w2p_Utilities_Date::duplicate怎么用?PHP w2p_Utilities_Date::duplicate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类w2p_Utilities_Date
的用法示例。
在下文中一共展示了w2p_Utilities_Date::duplicate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testDuplicateDifferent
/**
* Test Duplicate after changing one of the properties
*/
public function testDuplicateDifferent()
{
$date = new w2p_Utilities_Date('2010-09-14 10:00:00');
$date2 = $date->duplicate();
$date->minute = 15;
$this->assertNotEquals($date, $date2);
}
示例2: hook_calendar
public function hook_calendar($userId)
{
$date = new w2p_Utilities_Date(w2PgetParam($_GET, 'date', null));
$date->setTime(0, 0, 0);
$start = $date->duplicate();
$end = $date->duplicate();
$view = w2PgetParam($_GET, 'a', 'month_view');
switch ($view) {
case 'day_view':
break;
case 'week_view':
$end->addDays(6);
break;
case 'index':
case 'month_view':
$start->setDay(1);
$end->setDay($date->getDaysInMonth());
break;
case 'year_view':
$start->setMonth(1);
$start->setDay(1);
$end->setMonth(12);
$end->setDay(31);
break;
}
$end->setTime(23, 59, 59);
$holidays = HolidayFunctions::getHolidaysForDatespan($start, $end, $userId);
$itemsList = array();
foreach ($holidays as $i => $holiday) {
$date = $holiday['startDate'];
$end = $holiday['endDate'];
while (!$date->after(clone $end)) {
$itemsList[] = array('id' => $holiday['id'], 'name' => $holiday['name'], 'startDate' => $date->format(FMT_TIMESTAMP_DATE), 'endDate' => $date->format(FMT_TIMESTAMP_DATE), 'description' => $holiday['description']);
$date = $date->getNextDay();
}
}
return $itemsList;
}
示例3: array
// establish the focus 'date'
$date = w2PgetParam($_GET, 'date', null);
if (!$date) {
$date = new w2p_Utilities_Date();
} else {
$date = new w2p_Utilities_Date($date);
}
$date->setDay(1);
$date->setMonth(1);
$date->setTime(0, 0, 0);
$year = $date->getYear();
$prev_year = $date->format(FMT_TIMESTAMP_DATE);
$prev_year = (int) ($prev_year - 10000);
$next_year = $date->format(FMT_TIMESTAMP_DATE);
$next_year = (int) ($next_year + 10000);
$start = $date->duplicate();
$end = $date->duplicate();
$end->setMonth(12);
$end->setDay(31);
$end->setTime(23, 59, 59);
$holidays = array();
$holidaysList = HolidayFunctions::getDefaultCalendarHolidaysForDatespan($start, $end);
foreach ($holidaysList as $holiday) {
$id = 0;
$type = $holiday['type'];
$description = $holiday['description'] ? $holiday['description'] : "";
$name = $holiday['name'] ? $holiday['name'] : "";
$odate = $holiday['startDate'];
$oend = $holiday['endDate'];
$cdate = clone $odate;
while (!$cdate->after(clone $oend)) {