本文整理汇总了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;
}
}
示例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();
}
示例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();
}
示例4: getCreationDate
/**
* Gets a human-readable representation of the time when the message was sent
* @return string
*/
public function getCreationDate()
{
return $this->timestamp->diffForHumans();
}
示例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);
}
示例6: getCreationDate
/**
* Get the creation date of the team
*
* @return string The creation date of the team
*/
public function getCreationDate()
{
return $this->created->diffForHumans();
}
示例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);
}
示例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;
}
}