Html5 datetime input - is it possible to create a style view?

Is it possible to use html5 datetime input style?

<input type="datetime" value="2011-08-18T16:49Z">

This ISO date and time format is not very readable. Is it possible to format the representation of a value using some template using CSS or in other ways?

EDIT: I just realized that this question is browser dependent. For example, Opera implements this tag with good control when the user simply cannot enter an invalid date. The browser will then generate a correctly formatted W3C date and time string and send it to the server. Firfox 6 provides only standard input and does not care about what was entered at all. Chrome has a simple input field, but a valid w3C string is required to enter the form.

So my question probably doesn't make any sense. Therefore, I will ask one more thing: are there any recommendations for browsers that standardize the functionality / presentation of these user input fields?

+5
source share
2 answers

Once the form data is submitted, you can format it on the server side. If you want to do your client-side formatting, you cannot use CSS, but you can use javascript by loading the input value into a Date object and using various methods of this object to return the date components (getMonth (), getDate (), getFullYear () etc.). You can see the basic example at http://jsfiddle.net/G4XGP/ .

+2

, :

<input type="date">

format → 2011-08-11

+1

All Articles