Reputation: 21
I am using jquery.ui.datepicker in asp.net mvc3 on windows 7.I changed my system date format as
mm/dd/yyyy
to
yyyy-mm-dd
Then my project calender format also changed and default dates coming.Some times date picker calender is not showing.
Can anyone tell me how to solve this issue
Upvotes: 2
Views: 15361
Reputation: 2873
Sangar82's answer is the most complete and correct (I upvoted it for that reason) but a quicker way of just setting the format without creating/downloading a localisation file is:
$(".dateinput").datepicker({dateFormat: 'dd/mm/yy'});
Upvotes: 6
Reputation: 5230
Try to use Datepicker Localization
The date picker is designed to allow localizations to be easily created and used. Many localizations are already available, and additional ones are welcomed.
The date picker plugin maintains a manager object, $.datepicker, that lets you register new localizations. This object maintains an array of localization settings indexed by language, with '' accessing the default (English) version: $.datepicker.regional['fr'].
A new localization should be created in a separate JavaScript file named ui.datepicker-.js. Within a document.ready event it should add a new entry into the $.datepicker.regional array, indexed by the language code.
Code:
$('selector').datepicker($.datepicker.regional['<language>']);
Example
$('.myinput').datepicker($.datepicker.regional['fr']);
When you download the Jquery UI you can find in the following folder the translation of datepicker on several languages (69 translations)
development-bundle/ui/bundle/i18n
Example of use:
<script type="text/javascript" src="js/ui/development-bundle/ui/bundle/i18n/ui.datepicker-fr.js"></script>
<script type="text/javascript">
$(function() {
$.datepicker.setDefaults($.datepicker.regional['fr']);
$("#StartDate").datepicker();
});
</script>
Upvotes: 4