note 71632 added to function.localtime
| From: | anomie at users dot sourceforge dot net | Date: | Fri, 08 Dec 2006 20:22:31 +0000 |
| Subject: | note 71632 added to function.localtime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-120442@lists.php.net to get a copy of this message | ||
Here is another version of gmtime(). This one doesn't involve messing around with timezones at
all. Note that PHP4 users should check out the array_combine page for replacements for that
function.
<?php
function gmtime($ts=null, $is_associative=false){
if(is_null($ts)) $ts=time();
$t=array_map('intval',explode(',',gmdate('s,i,H,d,m,Y,w,z,I',$ts)));
$t[4]--;
$t[5]-=1900;
if(!$is_associative) return $t;
return
array_combine(array('tm_sec','tm_min','tm_hour','tm_mday','tm_mon',
'tm_year','tm_wday','tm_yday','tm_isdst'),
$t);
}
?>
----
Server IP: 216.194.113.175
Probable Submitter: 68.210.255.12
----
Manual Page -- http://www.php.net/manual/en/function.localtime.php
Edit -- https://master.php.net/note/edit/71632
Del: integrated -- https://master.php.net/note/delete/71632/integrated
Del: useless -- https://master.php.net/note/delete/71632/useless
Del: bad code -- https://master.php.net/note/delete/71632/bad+code
Del: spam -- https://master.php.net/note/delete/71632/spam
Del: non-english -- https://master.php.net/note/delete/71632/non-english
Del: in docs -- https://master.php.net/note/delete/71632/in+docs
Del: other reasons-- https://master.php.net/note/delete/71632
Reject -- https://master.php.net/note/reject/71632
Search -- https://master.php.net/manage/user-notes.php