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


PHP TimeDate::diffForHumans方法代碼示例

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


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

示例1: getLastActivity

 /**
  * Get the time when the group was most recently active
  *
  * @param  bool            $human True to output the last activity in a human-readable string, false to return a TimeDate object
  * @return string|TimeDate
  */
 public function getLastActivity($human = true)
 {
     if ($human) {
         return $this->last_activity->diffForHumans();
     } else {
         return $this->last_activity;
     }
 }
開發者ID:kleitz,項目名稱:bzion,代碼行數:14,代碼來源:Group.php

示例2: lastUpdate

 /**
  * Returns the amount of time passed since the server was
  * last updated in a human-readable form
  * @return string
  */
 public function lastUpdate()
 {
     return $this->updated->diffForHumans();
 }
開發者ID:kleitz,項目名稱:bzion,代碼行數:9,代碼來源:Server.php

示例3: getUpdated

 /**
  * Get the time when the page was last updated
  * @return string The page's last update time in a human-readable form
  */
 public function getUpdated()
 {
     $this->lazyLoad();
     return $this->updated->diffForHumans();
 }
開發者ID:bchhun,項目名稱:bzion,代碼行數:9,代碼來源:Page.php

示例4: getCreationDate

 /**
  * Gets a human-readable representation of the time when the message was sent
  * @return string
  */
 public function getCreationDate()
 {
     return $this->timestamp->diffForHumans();
 }
開發者ID:bchhun,項目名稱:bzion,代碼行數:8,代碼來源:Message.php

示例5: getTimestamp

 /**
  * Get the timestamp of the match
  *
  * @param string $format The date format. Leave blank if you want a relative time (e.g. 2 days ago)
  *
  * @return string The match's timestamp
  */
 public function getTimestamp($format = "")
 {
     if (empty($format)) {
         return $this->timestamp->diffForHumans();
     }
     return $this->timestamp->format($format);
 }
開發者ID:bchhun,項目名稱:bzion,代碼行數:14,代碼來源:Match.php

示例6: getCreationDate

 /**
  * Get the creation date of the team
  *
  * @return string The creation date of the team
  */
 public function getCreationDate()
 {
     return $this->created->diffForHumans();
 }
開發者ID:bchhun,項目名稱:bzion,代碼行數:9,代碼來源:Team.php

示例7: __invoke

 /**
  * @param \TimeDate $time   The TimeDate object we'll be representing as text
  * @param string    $format The format that will be shown. If a format isn't set, it'll return the difference in human readable time
  *
  * @return string
  */
 public function __invoke($time, $format = "")
 {
     $timeElement = '<span class="c-timestamp js-timestamp" title="%s">%s</span>';
     $outputTime = empty($format) ? $time->diffForHumans() : $time->format($format);
     return sprintf($timeElement, $time->format("F j, Y g:ia"), $outputTime);
 }
開發者ID:kleitz,項目名稱:bzion,代碼行數:12,代碼來源:HumanDateFilter.php

示例8: getLastLogin

 /**
  * Get the last login for a player
  * @param  bool   $human Whether to get the literal time stamp or a relative time
  * @return string The date of the last login
  */
 public function getLastLogin($human = true)
 {
     $this->lazyLoad();
     if ($human) {
         return $this->last_login->diffForHumans();
     } else {
         return $this->last_login;
     }
 }
開發者ID:bchhun,項目名稱:bzion,代碼行數:14,代碼來源:Player.php


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