如何使用PHP解释HTML5输入日期值 [英] How to interpret HTML5 input date value using PHP
问题描述
我需要让用户选择一个日期(最好采用格式为dd / mm / yy),然后我决定试用新的HTML5输入日期类型。但是我不知道如何解释它在服务器端给出的值。我得到的值是yyyy-mm-dd。你能帮我这个吗?
I need to let the users pick a date (preferable in the format dd/mm/yy) and I decide to try out new HTML5 input date type. However I don't know how to interpret the value it gives on the server side. The value I get is yyyy-mm-dd. Would you be able to help me with this?
如果用户使用不支持它的olser浏览器怎么办?他将如何输入日期?
What if the user uses an olser browser that does not support it, how will he enter the date?
推荐答案
$ datetime = new DateTime('2012-12-06');
$ new_date = $ datetime->格式('d / m / Y');
他们将看到纯文本字段。您可以确保他们输入验证日期。
They will see a plain text field. It will be up to you to make sure they enter a validate date.
这篇关于如何使用PHP解释HTML5输入日期值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!