note 36426 deleted from function.strtotime by sniper
| From: | sniper@php.net | Date: | Tue, 21 Oct 2003 11:00:03 +0000 |
| Subject: | note 36426 deleted from function.strtotime by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-58989@lists.php.net to get a copy of this message | ||
Note Submitter: czjsz_ah@stats.gov.cn
----
<?php
function ch_strtotime($d) {
$ar = array(
array("/½ñÌì|ÏÖÔÚ/","now "),
array("/×ò|ÉÏ|È¥/","-1 "),
array("/Ã÷|ÏÂ/","+1 "),
array("/^ǰ/","-2 "),
array("/^ºó/","+2 "),
array("/Äê/"," year "),
array("/ÔÂ/"," month "),
array("/ÖÜ|ÐÇÆÚ/"," week "),
array("/Ìì|ÈÕ/"," day"),
array("/Сʱ/"," hours "),
array("/·Ö/"," minutes "),
array("/Ãë/"," seconds "),
array("/(.+)ºó/","-\\1"),
array("/(.+)ǰ/","-\\1")
);
for($i=0;$i<count($ar);$i++) {
$patterns[$i] = $ar[$i][0];
$replace[$i] = $ar[$i][1];
}
$d = preg_replace($patterns,$replace,$d);
echo "<br>",date("Y-m-d H:i:s",strtotime($d));
}
// Àý
ch_strtotime("ÏÖÔÚ");
ch_strtotime("È¥Äê");
ch_strtotime("1Сʱ3·Ö40Ãë");
?>