DateTime globalization not working

May 16, 2011 at 10:34 PM

I've got the DateTime control on a page and I have all the globalization scripts a per the tutorial and examples.  However the date for the box is still showing the US formatted date instead of the en-NZ date format that my machine has installed of Day/Month/Year

Is there something else I need to do to get the globalization working?



May 17, 2011 at 5:12 PM

Hi Craig,

If you use the calendar option, the date part of the datetime is displayed with the help of the JQuery DateTimePicker, So in addition to the normal globalization setting you have to add a specific call that globalize the jquery calendar:

<%: Html.JQueryDatePickerGlobalizationScript() %>
pls, refer to the documentation fro the complete infos on this function:
This have to be placed at the start of your page after the jqueryUY scrip as per examples included with the binaries.
Unluckly, the globalization of the JQuery calendar is not very well supported, so maybe your culture is not supported so JQuery calendar fall back to en-US. 
In the documentation you will find the list of all supported cultures. 
We are working to compute automatically the settings needed by the jquery calendar by the normal culture setting that are better supported, 
in the meantime if your culture is not supported you have three choices:
1) you don't use the calendar option. In this case normal globalization settings are enough, and probably your culture will be included since normal globalization settings
use either the "global" library or the Microsoft ajax library depending on if you use Mvc3 with unobtrusive ajax or not. Both libraries are well supported,
and contains hundreds of cultures, so your culture should be included. 
2) pass manually one of the culture supported by the JQuery calendar to the  function Html.JQueryDatePickerGlobalizationScript. 
Probably there is another english culture with the same you can solve this way. Here the list of all cultures supported by the jQuery 
datetime picker: As you can see it is not very long......
3) define yourself the culture file of your culture by just correcting the en-US, then you use it yourself and submit it to JQUERY, so also other people of your 
country nay benefit of it.

May 17, 2011 at 8:09 PM

Thanks for that Frank.  I was getting confused because I say the global culture getting picked up with the jQuery but I didn't realise there was a seperate one for the datetime picker.  I added a en-NZ culture file and it works perfectly.




May 22, 2011 at 4:05 PM

Normal gloabalization settings just give informations about date  format, numbers formats, names of all months, dayweeks, and similar. Unluckly the jquery picker because uses also some labels such as

"close" that needs to be translated in all languages and cannot be taken from the globalization setting, so I am forced to add a globalization setting just for it :).

However if all the onse that have problems in their culture do what you have done and then submit the new generated culture file to the jquery project I hope in a short time all culture will be covered.