From: Janusz Dobrowolski Date: Sat, 26 Mar 2011 11:18:48 +0000 (+0100) Subject: Cleanup in add_months() X-Git-Tag: 2.3-final~735 X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=commitdiff_plain;h=68800c52eaf3f650212ebf7e41b1c6d9d32ef7be;p=fa-stable.git Cleanup in add_months() --- diff --git a/includes/date_functions.inc b/includes/date_functions.inc index 94525a33..6f8379e0 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);