Click here to Skip to main content
15,885,365 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How to resolve error .."The value '25-07-1988' is not valid for Date of Birth". in MVC5.

In my application is runnig fine on the local IIS with date in this format '25-07-1988' i.e dd-mm-yyyy
But after hosting on the production server Iam getting the error..Although it is accepting date in the format '07-25-1998' i.e mm-dd-yyyy format.

For solution I have also tried following
in web.config
XML
<system.web>

    <globalization culture="en-US" /> </system.web>


in global.asax
C#
protected void Application_BeginRequest()
        {
            CultureInfo info = new CultureInfo(System.Threading.Thread.CurrentThread.CurrentCulture.ToString());
            info.DateTimeFormat.ShortDatePattern = "dd.MM.yyyy";
            System.Threading.Thread.CurrentThread.CurrentCulture = info;
        }



But still same issue.
Please help with this issue.
Posted
Comments
Sreekanth Mothukuru 25-Jul-15 8:50am    
Also set the UI culture format to whichever you want to appear..
Suvendu Shekhar Giri 25-Jul-15 22:46pm    
It's always better to use "yyyy.MM.dd" as it has no other forms.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900