當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DateRange::Dates方法代碼示例

本文整理匯總了PHP中DateRange::Dates方法的典型用法代碼示例。如果您正苦於以下問題:PHP DateRange::Dates方法的具體用法?PHP DateRange::Dates怎麽用?PHP DateRange::Dates使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在DateRange的用法示例。


在下文中一共展示了DateRange::Dates方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testDateRangeReturnsAllDatesForRangeWithoutTime

 public function testDateRangeReturnsAllDatesForRangeWithoutTime()
 {
     $begin = Date::Create(2008, 9, 9, 10, 11, 12, 'UTC');
     $end = Date::Create(2008, 9, 12, 10, 11, 12, 'UTC');
     $range = new DateRange($begin, $end);
     $expected[] = $begin->GetDate();
     $expected[] = $begin->AddDays(1)->GetDate();
     $expected[] = $begin->AddDays(2)->GetDate();
     $expected[] = $begin->AddDays(3)->GetDate();
     $actual = $range->Dates();
     //		foreach ($expected as $d)
     //		{
     //			echo $d->ToString();
     //			echo "\n";
     //		}
     //
     //		echo "\n";
     //
     //		foreach ($actual as $d)
     //		{
     //			echo $d->ToString();
     //			echo "\n";
     //		}
     //		$this->assertEquals($expected, $actual);
     $this->assertEquals(count($expected), count($actual));
     $this->assertTrue($expected[0]->Equals($actual[0]), "Dates[0] are not equal");
     $this->assertTrue($expected[1]->Equals($actual[1]), "Dates[1] are not equal");
     $this->assertTrue($expected[2]->Equals($actual[2]), "Dates[2] are not equal");
     $this->assertTrue($expected[3]->Equals($actual[3]), "Dates[3] are not equal");
 }
開發者ID:utn-frm-si,項目名稱:booked,代碼行數:30,代碼來源:DateTests.php

示例2: __construct

 /**
  * @param IRestServer $server
  * @param int $scheduleId
  * @param IDailyLayout $dailyLayout
  * @param DateRange $dates
  * @param ResourceDto[] $resources
  * @param IPrivacyFilter $privacyFilter
  */
 public function __construct(IRestServer $server, $scheduleId, IDailyLayout $dailyLayout, DateRange $dates, $resources, IPrivacyFilter $privacyFilter)
 {
     $this->scheduleId = $scheduleId;
     $this->AddService($server, WebServices::GetSchedule, array(WebServiceParams::ScheduleId => $scheduleId));
     foreach ($dates->Dates() as $date) {
         $scheduleDate = new ScheduleSlotResponse($server, $date);
         foreach ($resources as $resource) {
             $scheduleResource = new ScheduleSlotResourceResponse($server, $resource, $privacyFilter);
             $slots = $dailyLayout->GetLayout($date, $resource->GetId());
             foreach ($slots as $slot) {
                 $scheduleResource->AddSlot($slot);
             }
             $scheduleDate->AddResource($scheduleResource);
         }
         $this->dates[] = $scheduleDate;
     }
 }
開發者ID:ksdtech,項目名稱:booked,代碼行數:25,代碼來源:ScheduleSlotsResponse.php


注:本文中的DateRange::Dates方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。