search

Home  >  Q&A  >  body text

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

前端post过来的数据如下

后台怎么对它进行处理。怎么跟数据库的时间字段进行对比。

PHP中文网PHP中文网2897 days ago245

reply all(2)I'll reply

  • PHP中文网

    PHP中文网2017-04-10 17:06:37

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

        $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);

    reply
    0
  • 黄舟

    黄舟2017-04-10 17:06:37

    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

    reply
    0
  • Cancelreply