Spionred
Spionred

Reputation: 807

Date format in asp.net MVC

I have created a simple application build using asp.net MVC and SQL Server targeting the azure platform. My question is around date formatting. I have added a date picker which correctly uses dd/mm/yyy format. however when I pick the date I get the following validation error.

enter image description here

The project was build using database first. here is a screenshot of the property for that data item:

enter image description here

Where do I change the validation to accept dd/MM/yyyy. Also is there a way to set it so if there is a user in the US it will change date picker and validation to MM/dd/yyyy?

in both situations the date will be saved to the database as standard yyyy-MM-dd hh:mm:ss

Upvotes: 0

Views: 991

Answers (2)

Hemant B
Hemant B

Reputation: 140

The issue is clearly with your date format. You are entering dates in the format of dd/MM/yyyy while the system is expecting MM/dd/yyyy.

  1. Please check in your model whether you have specified any specific date formats.

  2. Change the Ui culture of Kendo

Like this

    <script>
         //set current to the "en-GB" culture script
         kendo.culture("en-GB");
    </script>

Upvotes: 0

Steve Wellens
Steve Wellens

Reputation: 20620

Burn this into your brain:

mm is minutes.

MM is months.

Upvotes: 6

Related Questions