note 9466 added to imap_header
| From: | fabrizio dot s at celnet dot it | Date: | Sun, 05 Nov 2000 09:23:30 +0000 |
| Subject: | note 9466 added to imap_header | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-7406@lists.php.net to get a copy of this message | ||
//This Function convert the Header data format (ex: "Fry, 3 Nov 2000 10:24:57 +0100") into
numeric format (ex: "3/11/200 10:24:57").I hope this will help someone.
function convert_data(&$data2) {
//mette nella variabile extract i pro
$no_weekday = substr ($data2, 5);
$length= strlen ($no_weekday);
$max1= $length - 6;
$no_week_mer = substr ($no_weekday,0,$max1);
$final = $no_week_mer;
$final = str_replace (" Jan ", "/01/", $final);
$final = str_replace (" Feb ", "/02/", $final);
$final = str_replace (" Mar ", "/03/", $final);
$final = str_replace (" Apr ", "/04/", $final);
$final = str_replace (" May ", "/05/", $final);
$final = str_replace (" Jun ", "/06/", $final);
$final = str_replace (" Jul ", "/07/", $final);
$final = str_replace (" Aug ", "/08/", $final);
$final = str_replace (" Sep ", "/09/", $final);
$final = str_replace (" Oct ", "/10/", $final);
$final = str_replace (" Nov ", "/11/", $final);
$final = str_replace (" Dec ", "/12/", $final);
$data2 = $final;
}
//to use the
obj_header= imap_header($mail_connection,$msg_number);
function$date_msg=$obj_header->date;
convert_data($data_msg);
echo $date_msg;
http://www.php.net/manual/function.imap-header.php