note 95189 deleted from function.getdate by danbrown

From: Date: Thu, 17 Dec 2009 15:46:08 +0000
Subject: note 95189 deleted from function.getdate by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-164089@lists.php.net to get a copy of this message
Note Submitter: mail at daniel-faber dot de ---- Here is my version of gmgetdate: <?php function gmgetdate($time=null) { $tz = date_default_timezone_get(); date_default_timezone_set('UTC'); if (func_num_args() == 0) $result = getdate(); else $result = getdate($time); date_default_timezone_set($tz); return $result; } ?> It has several advantages over the other variants mentioned here: * better performance: it's seems to be even slightly faster than eric schultz' optimized version * maximum compatibility with getdate: * other variants return values in a different order and/or with different types (string instead of int). * getdate(null) is not the same as getdate(), this is why I use func_num_args()

« previous php.notes (#164089) next »