fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [10475] api: datetime handling for php-version < 5.3


From: Sigurd Nes
Subject: [Fmsystem-commits] [10475] api: datetime handling for php-version < 5.3
Date: Tue, 06 Nov 2012 09:49:59 +0000

Revision: 10475
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10475
Author:   sigurdne
Date:     2012-11-06 09:49:59 +0000 (Tue, 06 Nov 2012)
Log Message:
-----------
api: datetime handling for php-version < 5.3

Modified Paths:
--------------
    trunk/phpgwapi/inc/class.datetime.inc.php

Modified: trunk/phpgwapi/inc/class.datetime.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.datetime.inc.php   2012-11-06 09:47:48 UTC (rev 
10474)
+++ trunk/phpgwapi/inc/class.datetime.inc.php   2012-11-06 09:49:59 UTC (rev 
10475)
@@ -851,13 +851,28 @@
                                return 0;
                        }
 
+                       $hour   = 13;
+                       $minute = 0;
+                       $second = 0;
+
                        if( strpos($datestr, ':') )
                        {
+                               $date_part = explode(' ', $datestr);
+                               $time_part = explode(':', $date_part[1]);
+
+                               $hour   = (int) $time_part[0];
+                               $minute = (int) $time_part[1];
+                               $second = isset($time_part[2]) && $time_part[2] 
? (int)$time_part[2] : 0;
+                       }
+
+
+                       if( version_compare(PHP_VERSION, '5.3.0') >= 0  && 
strpos($datestr, ':'))
+                       {
                                return self::datetime_to_timestamp($datestr);
                        }
 
                        $date_array     = self::date_array($datestr);
-                       return mktime (13, 0, 0, $date_array['month'], 
$date_array['day'], $date_array['year']);
+                       return mktime ($hour, $minute, $second, 
$date_array['month'], $date_array['day'], $date_array['year']);
                }
 
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]