Home > Backend Development > PHP Tutorial > html5 - php怎么处理表单type为month类型的数据

html5 - php怎么处理表单type为month类型的数据

WBOY
Release: 2016-06-06 20:14:18
Original
1266 people have browsed it

前端post过来的数据如下
html5 - php怎么处理表单type为month类型的数据
后台怎么对它进行处理。怎么跟数据库的时间字段进行对比。

回复内容:

前端post过来的数据如下
html5 - php怎么处理表单type为month类型的数据
后台怎么对它进行处理。怎么跟数据库的时间字段进行对比。

你看这样行吗?希望对你有帮助

<code>    $str = "Tue Mar 22 2016 15:07:48 GMT+0800 (中国标准时间)";
    $arr = explode("GMT+0800", $str);
    $time = strtotime($arr[0]);
    echo date("Y-m-d H:i:s", $time);</code>
Copy after login

html5 input type=month 的表示形式是YYYY-MM,你这里的格式确认是month?
https://www.w3.org/TR/html-markup/input.month.html
http://www.w3schools.com/html/tryit.asp?filename=tryhtml_input_month

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template