note 51302 deleted from function.imap-fetch-overview by betz
| From: | betz@php.net | Date: | Wed, 20 Apr 2005 19:38:05 +0000 |
| Subject: | note 51302 deleted from function.imap-fetch-overview by betz | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-88284@lists.php.net to get a copy of this message | ||
Note Submitter: myzouip at freesurf dot fr
----
I have no found any functions which could convert the returned date to DATETIME... (ex: Sat, 5 Mar
2005 12:44:02 +0100). Just have maid my own function:
function get_datetime($char) {
$ENGLISH_DAY = substr($char, 0, 3);
$INT_DAY = substr($char, 5, 2);
if($INT_DAY < 10) {
$INT_DAY = substr($char, 5, 1);
$INT_YEAR = substr($char, 11, 4);
$INT_TIME = substr($char, 16, 8);
$ENGLISH_MON = substr($char, 7, 3);
$INT_DAY = "0".$INT_DAY;
}
else {
$INT_DAY = substr($char, 5, 2);
$INT_YEAR = substr($char, 12, 4);
$INT_TIME = substr($char, 17, 8);
$ENGLISH_MON = substr($char, 8, 3);
}
$MONTHS = array(
"Jan" => "01",
"Feb" => "02",
"Mar" => "03",
"Apr" => "04",
"May" => "05",
"Jun" => "06",
"Jul" => "07",
"Aug" => "08",
"Sep" => "09",
"Oct" => "10",
"Nov" => "11",
"Dec" => "12"
);
$INT_MON = $MONTHS[$ENGLISH_MON];
$DATETIME .= $INT_YEAR."-";
$DATETIME .= $INT_MON."-";
$DATETIME .= $INT_DAY." ";
$DATETIME .= $INT_TIME;
return $DATETIME;
}