Click here to Skip to main content
15,867,141 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
hi to all,
          Here i create datapicker for my start date field and another fields as end date .Now i need to show date format as dd/mm/yy. 
Here i used below script .If i change date  as 13-12-2014 i got error date field must be a date, how to resolve this issue.Kindly help me for this

  $('#IssueDate').datepicker({
            dateFormat: 'dd/MM/yy', minDate: 0, maxDate: 0
        });
Posted

Use
JavaScript
dateFormat : 'dd/mm/yy'


MM will return the month name.
 
Share this answer
 
Comments
JOTHI KUMAR Member 10918227 10-Dec-14 1:41am    
yeah u correct but here i put this its give correct format but in cshtml file i will give check validationmessagefor.if i click more than 12 for example if i click 13-12-2014 it got error Please enter a valid date.
1.The ASP.NET MVC application's view is using the current UI culture (and in the controller code current culture) for managing the format show and the conversion of DateTime and numbers (integer, float, double) values. So in your case it seems that the current culture is set up for English and this generate exception.

2.In order to solve your problem you should set, in your controller, the correct current UI culture and also current culture values needed like in the next example:
C#
Thread.CurrentThread.CurrentUICulture = new CultureInfo("de-DE");
//
// Set the thread's CurrentCulture the same as CurrentUICulture.
Thread.CurrentThread.CurrentCulture = Thread.CurrentThread.CurrentUICulture;


PS: If you want to find more details about multilingual in the context of an MVC web application you could read my next article: MVC Basic Site: Step 1 – Multilingual Site Skeleton[^] (If you need code for MVC4 get it from the 2nd or 3rd articles from this series.)
 
Share this answer
 

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