Jump to content

input type date html5 value


Recommended Posts


I am using the html5 input type date field in an asp page. I have it saving to the database fine, but how do I display the date as a variable when bringing the date back in the same input type tag? I need to bring it back in the same input tag so the date could be updated if the web user needs to change the original date when adding.




Link to comment
Share on other sites

Thanks but I have used other pop up calendars to select the date and the value will return from the database when revisiting that page. I am wondering if the new html5 tag shown here (input date)



is only used for input and the value cannot be set from the database?



<input type="date" name="MessageDatehappen" value="<%=MessageDatehappen%>" />

Link to comment
Share on other sites

It works fine for me. If I select a date with that and hit submit, the server shows something like this:


Input was received as:




Then if I change the HTML to show this:


<input type="date" name="bday" value="2013-12-18">


and submit the change, it renders the date field with that date selected. I'm testing with Opera.

Link to comment
Share on other sites

That's what I showed above, this is what the HTML for that field needs to look like:


<input type="date" name="bday" value="2013-12-18">


I don't know if that field requires yyyy-mm-dd or not, but that code definitely works in the TryIt editor, you can try it yourself. I would suggest that you convert the date that you have to yyyy-mm-dd format and use that.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...