年月日转 unixtime时间戳(PHP代码函数)

来源:互联网 发布:淘宝大促商品 编辑:程序博客网 时间:2024/05/17 02:18
//年月日转 unixtime时间戳(PHP代码函数)//代码来源:Monxin ./config/functions.phpfunction get_unixtime($date,$date_style) {if($date_style[0]=='m'){$temp=explode($date_style[1],$date);$temp2=explode($date_style[1],$date);$temp[0]=$temp2[1];$temp[1]=$temp2[0];$date=implode($date_style[1],$temp);}$r=strtotime($date);if($r!=false){return $r;}try{$datetime= new DateTime($date);return $datetime->format('U');}catch(Exception $e){return 0;}    } 

0 0
原创粉丝点击