このコードを試してください:
$current_date_time_get_updated_on_date_format = '';
function get_updated_on_date_format($dt_updated, $prefix = 'Updated ', $at = 'at ') {
global $current_date_time_get_updated_on_date_format;
if ($current_date_time_get_updated_on_date_format == '') {
$current_date_time_get_updated_on_date_format = now();
}
$i_second_now = strtotime($current_date_time_get_updated_on_date_format);
$i_second_dt_updated = strtotime($dt_updated);
$i_second_diff = $i_second_now - $i_second_dt_updated;
$s_return_date_format = '';
if ($i_second_diff < 0) {
// Developers Uploading Time, Time Zone Gap Patch
$s_return_date_format = $prefix . $at . date('g:ia \o\n F jS, Y', strtotime($dt_updated));
} else if ($i_second_diff < 60) {
$s_return_date_format = $prefix . $i_second_diff . ' seconds ago ';
} elseif ($i_second_diff < (60 * 60)) {
$s_return_date_format = $prefix . round(($i_second_diff / 60), 0) . ' minitues ago ';
} elseif ($i_second_diff < (60 * 60 * 24)) {
$s_return_date_format = $prefix . round(($i_second_diff / (60 * 60)), 0) . ' hours ago ';
} else {
$s_return_date_format = $prefix . $at . date('g:ia \o\n F jS, Y', strtotime($dt_updated));
}
return $s_return_date_format;
}
function now() {
// it should extract database time in this format 'YYYY-MM-DD HH:MM:SS'
return mysql_now_value;
}