展开全部
如果将时间格式写为2015-02-04或者2015/02/04这样转起来比较简单些一个函数就行了,$time='2015-02-04';strtotime($time);如果非要用2015年02月04日可以这样写:
$tr="2015年02月04日";
$pos1=mb_strpos($tr,'月',0,'utf-8');
$str1=mb_substr($tr,$pos1-2,2,'utf-8');
$pos2=mb_strpos($tr,'年',0,'utf-8');
$str2=mb_substr($tr,$pos2-4,4,'utf-8');
$pos3=mb_strpos($tr,'日',0,'utf-8');
$str3=mb_substr($tr,$pos3-2,2,'utf-8');
$time=$str2.'-'.$str1.'-'.$str3;
echo strtotime($time);
$tr="2015年02月04日";
$pos1=mb_strpos($tr,'月',0,'utf-8');
$str1=mb_substr($tr,$pos1-2,2,'utf-8');
$pos2=mb_strpos($tr,'年',0,'utf-8');
$str2=mb_substr($tr,$pos2-4,4,'utf-8');
$pos3=mb_strpos($tr,'日',0,'utf-8');
$str3=mb_substr($tr,$pos3-2,2,'utf-8');
$time=$str2.'-'.$str1.'-'.$str3;
echo strtotime($time);
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询