note 95189 added to function.getdate

From: Date: Thu, 17 Dec 2009 11:49:00 +0000
Subject: note 95189 added to function.getdate
Groups: php.notes 
Request: Send a blank email to php-notes+get-164074@lists.php.net to get a copy of this message
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() ---- Server IP: 212.124.37.9 Probable Submitter: 78.43.221.3 ---- Manual Page -- http://www.php.net/manual/en/function.getdate.php Edit -- https://master.php.net/note/edit/95189 Del: integrated -- https://master.php.net/note/delete/95189/integrated Del: useless -- https://master.php.net/note/delete/95189/useless Del: bad code -- https://master.php.net/note/delete/95189/bad+code Del: spam -- https://master.php.net/note/delete/95189/spam Del: non-english -- https://master.php.net/note/delete/95189/non-english Del: in docs -- https://master.php.net/note/delete/95189/in+docs Del: other reasons-- https://master.php.net/note/delete/95189 Reject -- https://master.php.net/note/reject/95189 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#164074) next »