2

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

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

5 Comments

Yes Stian Standahl. but is it not possible to display date field itself?
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.
ya that is fine. but actually in this plugin we dont have year wise navigation right?
here is a list of different javascript libraries that gives you datepicking possibility. codeanddesign-studio.com/2011/03/02/…
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?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.