From 7a933cd60d4b1c6a39434cd7ccaecde4e7ea18c6 Mon Sep 17 00:00:00 2001 From: Sven Slootweg Date: Fri, 6 Jul 2012 02:49:31 +0200 Subject: [PATCH] Fix years calculation and use properties instead of formatting function for time difference calculation. --- include.datetime.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/include.datetime.php b/include.datetime.php index 24bc875..ba450ee 100644 --- a/include.datetime.php +++ b/include.datetime.php @@ -197,13 +197,13 @@ function time_ago($timestamp, $locale) $date2 = new DateTime("now", new DateTimeZone("GMT")); $interval = $date1->diff($date2); - $years = (int)$interval->format("%G"); - $months = (int)$interval->format("%m"); + $years = (int)$interval->y; + $months = (int)$interval->m; $weeks = (int)$interval->format("%U"); - $days = (int)$interval->format("%d"); - $hours = (int)$interval->format("%H"); - $minutes = (int)$interval->format("%i"); - $seconds = (int)$interval->format("%S"); + $days = (int)$interval->d; + $hours = (int)$interval->h; + $minutes = (int)$interval->i; + $seconds = (int)$interval->s; if($years > 1) {