예제 #1
0
function decode_date($str)
{
    if (preg_match('/(\\w+) (\\d{1,2}), (\\d{4})/i', $str, $matches)) {
        //MMM DD, YYYY
        $month_no = decode_month_name($matches[1]);
        $year_no = $matches[3];
        $day_no = $matches[2];
    }
    return array($day_no, $month_no, $year_no);
}
예제 #2
0
 private function decode_datetime($str)
 {
     preg_match('/(\\d{1,2})?\\s?(\\w+)?\\s?(\\d{1,2}):(\\d\\d)/iU', $str, $matches);
     $day_no = $matches[1];
     if (!$day_no) {
         $day_no = date('d');
     }
     if ($matches[2]) {
         $month_no = decode_month_name($matches[2]);
     } else {
         $month_no = date('n');
     }
     $hour = $matches[3];
     $minute = $matches[4];
     $year_no = date('Y');
     if (mktime($hour, $minute, 0, $month_no, $day_no, $year_no) < time() - 2 * 100 * 24 * 3600) {
         $year_no++;
     }
     return array($day_no, $month_no, $year_no, $hour, $minute);
 }