本文整理匯總了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;
}