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