From 760d533ccdd6df4a9b41ec1247cff555ee7de325 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Thu, 21 Oct 2021 16:55:55 +0800 Subject: [PATCH] * Fix bug #15693. --- framework/base/helper.class.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/framework/base/helper.class.php b/framework/base/helper.class.php index ec1acf2e2c..c559e38e8c 100644 --- a/framework/base/helper.class.php +++ b/framework/base/helper.class.php @@ -504,7 +504,12 @@ class baseHelper */ static public function diffDate($date1, $date2) { - return round((strtotime($date1) - strtotime($date2)) / 86400, 0); + /* Get the timestamp in the current operating system. */ + $date1 = new DateTime($date1); + $date2 = new DateTime($date2); + $date1 = date_format($date1, "U"); + $date2 = date_format($date2, "U"); + return round(($date1 - $date2) / 86400, 0); } /**