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


PHP Time::Hour方法代码示例

本文整理汇总了PHP中Time::Hour方法的典型用法代码示例。如果您正苦于以下问题:PHP Time::Hour方法的具体用法?PHP Time::Hour怎么用?PHP Time::Hour使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Time的用法示例。


在下文中一共展示了Time::Hour方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: SetTime

 /**
  * @param Time $time
  * @param bool $isEndTime
  * @return Date
  */
 public function SetTime(Time $time, $isEndTime = false)
 {
     $date = Date::Create($this->Year(), $this->Month(), $this->Day(), $time->Hour(), $time->Minute(), $time->Second(), $this->Timezone());
     if ($isEndTime) {
         if ($time->Hour() == 0 && $time->Minute() == 0 && $time->Second() == 0) {
             return $date->AddDays(1);
         }
     }
     return $date;
 }
开发者ID:hugutux,项目名称:booked,代码行数:15,代码来源:Date.php

示例2: Compare

 /**
  * Compares this time to the one passed in
  * Returns:
  * -1 if this time is less than the passed in time
  * 0 if the times are equal
  * 1 if this time is greater than the passed in time
  * @param Time $time
  * @param Date|null $comparisonDate date to be used for time comparison
  * @return int comparison result
  */
 public function Compare(Time $time, $comparisonDate = null)
 {
     if ($comparisonDate != null) {
         $myDate = Date::Create($comparisonDate->Year(), $comparisonDate->Month(), $comparisonDate->Day(), $this->Hour(), $this->Minute(), $this->Second(), $this->Timezone());
         $otherDate = Date::Create($comparisonDate->Year(), $comparisonDate->Month(), $comparisonDate->Day(), $time->Hour(), $time->Minute(), $time->Second(), $time->Timezone());
         return $myDate->Compare($otherDate);
     }
     return $this->GetDate()->Compare($time->GetDate());
 }
开发者ID:hugutux,项目名称:booked,代码行数:19,代码来源:Time.php

示例3: testCanCreateTimeInServerTimezone

 public function testCanCreateTimeInServerTimezone()
 {
     $hour = 10;
     $min = 22;
     $sec = 21;
     $time = new Time($hour, $min, $sec);
     $this->assertEquals("{$hour}:{$min}:{$sec}", $time->ToString());
     $this->assertEquals($hour, $time->Hour());
     $this->assertEquals($min, $time->Minute());
     $this->assertEquals($sec, $time->Second());
     $time = new Time($hour, $min);
     $this->assertEquals("{$hour}:{$min}:00", $time->ToString());
     $this->assertEquals($hour, $time->Hour());
     $this->assertEquals($min, $time->Minute());
     $this->assertEquals(0, $time->Second());
 }
开发者ID:utn-frm-si,项目名称:booked,代码行数:16,代码来源:DateTests.php


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