How to interpret HTML5 input date value using PHP

html, input, php

Solution

Just convert the date using PHP's date functionality (`date()`, `DateTime`, etc)

`$datetime = new DateTime('2012-12-06');`

`$new_date = $datetime->format('d/m/Y');`

They will see a plain text field. It will be up to you to make sure they enter a validate date.

Problem

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. How can I do this? What if the user uses an older browser that does not support it, how will they enter the date?

Original source