[pLog-svn] r5852 - plog/branches/lifetype-1.2/class/locale

oscar at devel.lifetype.net oscar at devel.lifetype.net
Tue Aug 21 16:24:42 EDT 2007


Author: oscar
Date: 2007-08-21 16:24:42 -0400 (Tue, 21 Aug 2007)
New Revision: 5852

Modified:
   plog/branches/lifetype-1.2/class/locale/locale.class.php
Log:
Allow Locale::formatDate() to receive Unix timestamps as its parameter, in addition to objects from the Timestamp class.

Modified: plog/branches/lifetype-1.2/class/locale/locale.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/locale/locale.class.php	2007-08-20 20:27:32 UTC (rev 5851)
+++ plog/branches/lifetype-1.2/class/locale/locale.class.php	2007-08-21 20:24:42 UTC (rev 5852)
@@ -492,7 +492,15 @@
 				$format = $this->_dateFormat;
 				
             // Get the unix time stamp 
-            $time = $timeStamp->getTimestamp(DATE_FORMAT_UNIXTIME);
+			if( strtolower(get_class( $timeStamp )) == "timestamp") {
+            	$time = $timeStamp->getTimestamp(DATE_FORMAT_UNIXTIME);
+			}
+			else {
+				// we can assume it's a unix timestamp
+				$time = $timeStamp;
+				$timeStamp = new Timestamp( $time );
+			}
+			
             $timeZoneSec = date("Z", $time);
             if ( $blog ) {
                 //
@@ -663,7 +671,14 @@
 				$format = $this->_dateFormat;
 				
             // Get the unix time stamp 
-            $time = $timeStamp->getTimestamp(DATE_FORMAT_UNIXTIME);
+			if( strtolower(get_class( $timeStamp )) == "timestamp") {
+            	$time = $timeStamp->getTimestamp(DATE_FORMAT_UNIXTIME);
+			}
+			else {
+				// we can assume it's a unix timestamp
+				$time = $timeStamp;
+				$timeStamp = new Timestamp( $time );
+			}
             $timeZoneSec = date("Z", $time);
             if ( $blog ) {
                 //



More information about the pLog-svn mailing list