当前位置: 首页>>代码示例>>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;未经允许,请勿转载。