本文整理汇总了PHP中date::convert_datetime方法的典型用法代码示例。如果您正苦于以下问题:PHP date::convert_datetime方法的具体用法?PHP date::convert_datetime怎么用?PHP date::convert_datetime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类date
的用法示例。
在下文中一共展示了date::convert_datetime方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parse_created_time
function parse_created_time($row)
{
global $date;
$s_date = $row["created_time"];
$ts = date::convert_datetime($s_date);
$time_between = (time() - $ts) / 60;
if ($time_between < 1) {
$out = _("minute ago");
} else {
if ($time_between >= 1 && $time_between < 59) {
$out = round($time_between, 0) . " " . _("minutes ago");
} else {
if ($time_between >= 60 && $time_between < 60 * 2) {
$out = round($time_between / 60, 0) . " " . _("hours ago");
} else {
if ($time_between >= 60 && $time_between < 60 * 24) {
$out = round($time_between / 60, 0) . " " . _("hours ago");
} else {
$out = date("j.m.Y", $ts);
}
}
}
}
$row["created_time"] = $out;
return $row;
}