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


PHP w2p_Utilities_Date::duplicate方法代码示例

本文整理汇总了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);
 }
开发者ID:eureka2,项目名称:web2project,代码行数:10,代码来源:date.test.php

示例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;
 }
开发者ID:Raithlin,项目名称:web2project-holiday,代码行数:38,代码来源:holiday.class.php

示例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)) {
开发者ID:Raithlin,项目名称:web2project-holiday,代码行数:31,代码来源:holiday.php


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