We have Default date type in HTML5. It has some default date format like mm/dd/yy. ( eg. 05/21/88). i want to change this date format as per my requirement dynamically. is there any option for this? Thanks in Advance.
1 Answer
You could have a hidden field right before the datefield and create a onchange event on the date field that runs a javascript call, which converts the date format into your preferred format and stores it into the hidden field.
You use a datepicker from one of these javascript libraries. Most of these libraries have possibilities to change dateformat.
5 Comments
Pyare
Yes Stian Standahl. but is it not possible to display date field itself?
Stian Standahl
After reading up on it. It doesn't look like it is possible to show a different dateformat. If you use this date input it will not be fully supported by all browsers. (w3schools.com/html/html5_form_input_types.asp). I would recommend using jquery UI (jqueryui.com/datepicker) where you can change the dateformat.
Pyare
ya that is fine. but actually in this plugin we dont have year wise navigation right?
Stian Standahl
here is a list of different javascript libraries that gives you datepicking possibility. codeanddesign-studio.com/2011/03/02/…
Stian Standahl
can you set my answer as solution? do you have a short explanation on how you solved the problem, and possibly which javascript library you used?