note 85973 added to function.date
| From: | cservant at videotron dot ca | Date: | Fri, 26 Sep 2008 15:14:39 +0000 |
| Subject: | note 85973 added to function.date | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-144754@lists.php.net to get a copy of this message | ||
This is a code to convert RSS pubDate to a timestamp.
A timestamp is an INT which is faster and easier to sort than VARCHAR.
function pubDate_to_timestamp($time){
//Thu, 21 Aug 2008 01:14:36 PDT
//=> date("D, j M Y H:i:s T");
$time = explode(' ', $time);
$chrono = explode(':', $time[4]);
$month = array('Jan' => 1, 'Feb' => 2, 'Mar' => 3,
'Apr' => 4, 'May' => 5,
'Jun' => 6, 'Jul' => 7, 'Aug' => 8,
'Sep' => 9, 'Oct' => 10,
'Nov' => 11, 'Dec' => 12);
$mktime = mktime($chrono[0], $chrono[1], $chrono[2], $month[$time[2]], $time[1], $time[3],
$time[5]);
return $mktime;
}
----
Server IP: 216.235.15.211
Probable Submitter: 74.58.228.39
----
Manual Page -- http://www.php.net/manual/en/function.date.php
Edit -- https://master.php.net/note/edit/85973
Del: integrated -- https://master.php.net/note/delete/85973/integrated
Del: useless -- https://master.php.net/note/delete/85973/useless
Del: bad code -- https://master.php.net/note/delete/85973/bad+code
Del: spam -- https://master.php.net/note/delete/85973/spam
Del: non-english -- https://master.php.net/note/delete/85973/non-english
Del: in docs -- https://master.php.net/note/delete/85973/in+docs
Del: other reasons-- https://master.php.net/note/delete/85973
Reject -- https://master.php.net/note/reject/85973
Search -- https://master.php.net/manage/user-notes.php