Input type DateTime - Value format?

后端 未结 7 811
长发绾君心
长发绾君心 2020-11-27 18:10

In which format should I put the date and time, for use in the HTML5 input element with datetime type?

I have tried:

  • 1338575502
7条回答
  •  心在旅途
    2020-11-27 18:23

    For what it's worth, with iOS7 dropping support for datetime you need to use datetime-local which doesn't accept timezone portion (which makes sense).

    Doesn't work (iOS anyway):

     
    

    Works:

    
    

    PHP for value (windows safe):

    strftime('%Y-%m-%dT%H:%M:%S', strtotime($my_datetime_input))
    

提交回复
热议问题