[Jaws-commits] r13218 - in trunk/jaws/html/include/Jaws: . Date

afz at jaws-project.com afz at jaws-project.com
Fri Aug 3 08:49:31 UTC 2012


Author: afz
Date: 2012-08-03 08:49:31 +0000 (Fri, 03 Aug 2012)
New Revision: 13218

Modified:
   trunk/jaws/html/include/Jaws/Date/Gregorian.php
   trunk/jaws/html/include/Jaws/PHPFunctions.php
Log:
Added gmgetdate method equivalent getdate

Modified: trunk/jaws/html/include/Jaws/Date/Gregorian.php
===================================================================
--- trunk/jaws/html/include/Jaws/Date/Gregorian.php	2012-08-03 08:49:12 UTC (rev 13217)
+++ trunk/jaws/html/include/Jaws/Date/Gregorian.php	2012-08-03 08:49:31 UTC (rev 13218)
@@ -59,16 +59,16 @@
             $date = $year;
         }
 
-        $date = getdate($date);
+        $date = gmgetdate($date);
         return array(
                 'seconds' => str_pad($date['seconds'], 2, '0', STR_PAD_LEFT),
                 'minutes' => str_pad($date['minutes'], 2, '0', STR_PAD_LEFT),
                 'hours'   => str_pad($date['hours'],   2, '0', STR_PAD_LEFT),
                 'mday'    => str_pad($date['mday'],    2, '0', STR_PAD_LEFT),
-                'wday'    => $date['wday'],
+                'wday'    => (int)$date['wday'],
                 'mon'     => str_pad($date['mon'],  2, '0', STR_PAD_LEFT),
                 'year'    => str_pad($date['year'], 4, '0', STR_PAD_LEFT),
-                'yday'    => $date['yday'],
+                'yday'    => (int)$date['yday'],
                 'weekday' => $this->DayString($date['wday']),
                 'month'   => $this->MonthString($date['mon']),
             );

Modified: trunk/jaws/html/include/Jaws/PHPFunctions.php
===================================================================
--- trunk/jaws/html/include/Jaws/PHPFunctions.php	2012-08-03 08:49:12 UTC (rev 13217)
+++ trunk/jaws/html/include/Jaws/PHPFunctions.php	2012-08-03 08:49:31 UTC (rev 13218)
@@ -524,3 +524,13 @@
         return false;
     }
 }
+
+/**
+ * Get GMT/UTC date/time information
+ * @see http://www.php.net/getdate
+ */
+function gmgetdate($ts = null)
+{
+    $k = array('seconds','minutes','hours','mday', 'wday','mon','year','yday','weekday','month', 0);
+    return array_combine($k, explode(':', gmdate('s:i:G:j:w:n:Y:z:l:F:U', is_null($ts)? time() : $ts)));
+}



More information about the Jaws-commits mailing list