0

I try to convert a String that contains for example 28-11-2015 to put it as default value on html date input but to do this it must be like that 2015-11-28
HTML / JAVA / JEE / SQL NB: The String is request value of another input that it have been inserted by the user.

<input type="date" value="${date_rv}" name="date_rv_i" readonly ><br>

This is the result

And this is what I want


enter image description here

Anand Singh
  • 2,343
  • 1
  • 22
  • 34
S4L4H
  • 402
  • 1
  • 5
  • 21
  • Okay, so it sounds like you need to parse the date in one format, and format it in another. There are *lots* of questions about parsing and formatting dates from Java. Look for those, and try the answers. If you still have difficulties, put what you've tried and what went wrong into your question. – Jon Skeet Nov 18 '15 at 12:53
  • @JonSkeet i have try a lot of edition to covert the input to date with the format that i want and return it to string but it not work – S4L4H Nov 18 '15 at 13:11
  • Well you should show what you've tried and what happened then. – Jon Skeet Nov 18 '15 at 14:07

2 Answers2

3

There is no solution if using HTML only (No way with HTML alone) i think you should use jquery the suitable jquery plugin is jQuery Masked Input

OR you can use jquery datepicker

Darshan Mothreja
  • 506
  • 4
  • 13
0

Its not possible,See this answer https://stackoverflow.com/a/9519493/3143384

You can use jquery datepicker. It provides many option, also your required date format.

Community
  • 1
  • 1
Anand Singh
  • 2,343
  • 1
  • 22
  • 34