0

I have a form on which the user enters a date value using a KendoUI widget. This widget sets the date as per the local pc's culture settings. The problem is because in the dev environment the local pc and server is set to US culture setting and in production it is UK settings. When the code is moved to production environment, and when users access the site and enter 1st june, it gets saved in the server as 6th Jan. The server has UK culture.

How to ensure that no matter what the local end users culture settings, the values always get saved in UK culture settings. The code needs to be able to handle that.

user20358
  • 14,182
  • 36
  • 114
  • 186
  • Is this question answered for you now? To stimulate the correct use of SO it is necessary to accept one of the given answers (so the question is somehow "closed") (I know you knew this:p). If your question is not yet answered, please comment to make clear what's not clear to you. – Nick N. May 13 '13 at 13:01

3 Answers3

2

I think this could help you, if you are willing to do it in the C# backend.

    DateTime yourdate = DateTime.Now; //Your date here instead of DateTime.Now    

    System.Globalization.CultureInfo cultureinfo = 
                                      new System.Globalization.CultureInfo("en-gb");

    DateTime dt = DateTime.Parse(yourdate, cultureinfo);
Nick N.
  • 12,902
  • 7
  • 57
  • 75
1

If you are using Kendo-UI try to read about globalization and what controls are affected. http://docs.kendoui.com/getting-started/framework/globalization/overview:

This is a list of Widgets that depend on culture info Calendar,DatePicker,TimePicker, DateTimePicker, NumericTextBox.

 <script type="text/javascript">
 //set current to the "UK" culture script
 kendo.culture("UK");
 </script>
danywalls
  • 709
  • 1
  • 10
  • 27
1

similar question answered at https://stackoverflow.com/a/16017691/942855

add the below segment in web.config ?

<globalization 
    enableClientBasedCulture="true" 
    uiCulture="auto" 
    culture="auto" />

and read your date in code as DateTime format. that should not give you a problem.

you can also take help of Kendo globalization references <script src="kendo.culture.en-GB.js"></script>

Community
  • 1
  • 1
HaBo
  • 13,999
  • 36
  • 114
  • 206