When asking for a date in a HTML form, in the past I was using different solutions:
Using 3 different fields for day, month, year
Using a text field, but adding to the label something like "Start date (example: 31-12-2013)"
Using a reverse date, e.g. 2013-12-31
Now I would like to use HTML5, and just have a input type='date'
. This should also help users with mobiles.
For some browsers this may offer a date picker, for some just a text fields. But we all know there are different date formats, and sometimes the user's machine is not configured as he/she would expect. For instance, if I enter a date of 3 January 2014 as 03-01-2014 this can be interpreted as 1 March 2014 in other cultures.
What is the best I can do to help users to prevent mistakes? Is there a way to write an example, without knowing in advance what are his/her browser settings? And how do I know that PHP will interpret the date correctly?