From 2d8bbd87db819811c6f73bf5e81db294913b385c Mon Sep 17 00:00:00 2001 From: Janusz Dobrowolski Date: Sat, 26 Mar 2011 12:18:48 +0100 Subject: [PATCH] Cleanup in add_months() --- includes/date_functions.inc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/includes/date_functions.inc b/includes/date_functions.inc index 94525a3..6f8379e 100644 --- a/includes/date_functions.inc +++ b/includes/date_functions.inc @@ -266,11 +266,10 @@ function add_months($date, $months) // accepts negative values as well { global $date_system; list($day, $month, $year) = explode_date_to_dmy($date); + $months += $year*12+$month; $month = ($months-1)%12+1; $year = ($months-$month)/12; - if ($month < 0) - $month += 12; $timet = mktime(0,0,0, $month, min($day, days_in_month($month, $year)), $year); -- 2.30.2