changeset 276:be152168d945

Use DateTime objects instead of UNIX timestamp integers for MG_DATE values.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 15 May 2019 04:13:59 +0300
parents bc7bda1d1410
children 4080b9bde2ac
files mgallery.php mgtool.php
diffstat 2 files changed, 2 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mgallery.php	Wed May 15 01:24:18 2019 +0300
+++ b/mgallery.php	Wed May 15 04:13:59 2019 +0300
@@ -349,10 +349,9 @@
 function mgTimeStr($stamp)
 {
   global $pageLang, $pageCharset;
-  //  return date("d M Y (H:i:s)", $stamp);
   $pageLocale = strtolower($pageLang)."_".strtoupper($pageLang).".".$pageCharset;
   setlocale(LC_TIME, $pageLocale);
-  return strftime("%d %b %Y (%H:%M:%S)", $stamp);
+  return strftime("%d %b %Y (%H:%M:%S)", is_object($stamp) ? $stamp->getTimestamp() : $stamp);
 }
 
 
--- a/mgtool.php	Wed May 15 01:24:18 2019 +0300
+++ b/mgtool.php	Wed May 15 04:13:59 2019 +0300
@@ -232,7 +232,7 @@
         return $val;
 
     case MG_DATE:
-      return date_timestamp_get(date_create_from_format("Y:m:d H:i:s", $val));
+      return date_create_from_format("Y:m:d H:i:s", $val);
 
     default:
       return $val;