note 86395 added to function.getdate
| From: | Anonymous at osu1 dot php dot net | Date: | Thu, 16 Oct 2008 14:01:46 +0000 |
| Subject: | note 86395 added to function.getdate | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-145424@lists.php.net to get a copy of this message | ||
I couldn't get the last 2 examples of gmgetdate() to work, so here's a modification that
did work for me that behaves exactly like getdate() :
<?php
function gmgetdate($timestamp = null) {
if (is_null($timestamp)) { $timestamp = time(); }
$dateParts = array(
'mday' => 'j',
'wday' => 'w',
'yday' => 'z',
'mon' => 'n',
'year' => 'Y',
'hours' => 'G',
'minutes' => 'i',
'seconds' => 's',
'weekday' => 'l',
'month' => 'F',
0 => 'U'
);
while (list($part, $format) = each($dateParts)) {
$GMdateParts[$part] = gmdate($format, $timestamp);
}
return $GMdateParts;
}
?>
----
Server IP: 216.235.15.211
Probable Submitter: 199.212.17.130
----
Manual Page -- http://www.php.net/manual/en/function.getdate.php
Edit -- https://master.php.net/note/edit/86395
Del: integrated -- https://master.php.net/note/delete/86395/integrated
Del: useless -- https://master.php.net/note/delete/86395/useless
Del: bad code -- https://master.php.net/note/delete/86395/bad+code
Del: spam -- https://master.php.net/note/delete/86395/spam
Del: non-english -- https://master.php.net/note/delete/86395/non-english
Del: in docs -- https://master.php.net/note/delete/86395/in+docs
Del: other reasons-- https://master.php.net/note/delete/86395
Reject -- https://master.php.net/note/reject/86395
Search -- https://master.php.net/manage/user-notes.php