Skip to content

Instantly share code, notes, and snippets.

@lnsoso
Created December 9, 2013 04:31
Show Gist options
  • Save lnsoso/7867426 to your computer and use it in GitHub Desktop.
Save lnsoso/7867426 to your computer and use it in GitHub Desktop.
把 “2013 十二月 9 7:01” 这种日期格式处理成 PHP 标准的时间
<?php
date_default_timezone_set('Asia/Shanghai');
$str = '2013 十二月 9 7:01';
// @TODO : 添加更多的中/英文月份
$chs = array('十二月');
$eng = array('dec');
$str = str_replace($chs, $eng, $str);
$str = implode(array_reverse(explode(' ', $str)), ' ');
var_dump($str, strtotime($str));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment