I am designing a HTML form where i have to take date in "DD/MM/YY" or "DD/MM/YYYY" format and i have to achieve this task using only HTML date control. I have done extensive research and haven't found any way to do it. Can someone help me.
Asked
Active
Viewed 5,912 times
1
-
You need to use jquery datepicker plugin. – Nitin Dhomse Oct 06 '17 at 05:24
-
Or using HTML5 ...https://stackoverflow.com/questions/17080963/html5-pattern-for-formatting-input-box-to-take-date-mm-dd-yyyy – Nitin Dhomse Oct 06 '17 at 05:26
-
I have to use date type only and i can't use text or Jquery. – Anidh Singh Oct 06 '17 at 05:28
2 Answers
1
Refer this link: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/date Or you can use jquery date picker also for this.datepicker is very easy to use.

Naveen Sharma
- 11
- 2
-
I did go through that documentation but there was no option of such sort and moreover i can't use jQuery – Anidh Singh Oct 06 '17 at 06:15
0
<form method="POST" action="">
<input type="text" pattern="(0[1-9]|[12][0-9]|3[01])[- /.](0[1-9]|1[012])[- /.](19|20)\d\d" required />
<button>ok</button>
</form>
Use regular expression like patterns.Refer HTML5 pattern, Docs, http://html5pattern.com/Dates

Suriya Subramaniyan
- 137
- 7
-
-
1There is no way to change date format without any dependencies,refer https://stackoverflow.com/questions/7372038/is-there-any-way-to-change-input-type-date-format @AnidhSingh – Suriya Subramaniyan Oct 06 '17 at 06:52