问题
I am working on Kentico 12 MVC Site in version 12.0.59 and default culture set to "en-AU".
I have created a Form named "Sample Form".
When I am trying to save the datetime in either "MM/DD/YYYY" or "YYYY/MM/DD" it works correctly and saves the data in the database for the form.
But when I try to save the datetime in format "DD/MM/YYYY" and click on Submit button to save the data in database, it shows the error as follows:
Can anyone please suggest for the same?
Thanks
回答1:
One potential reason for that is a missing culture setting for the current thread in the code. It is not enough just to select the default culture "en-AU" in the Kentico admin interface. In the code before processing your request you should set the desired culture for the thread as well:
Thread.CurrentThread.CurrentUICulture = yourDefaultOrSelectedCulture;
Thread.CurrentThread.CurrentCulture = yourDefaultOrSelectedCulture;
In Kentico example Dancing Goat MVC website you can see this implemented in MultiCultureMvcRouteHandler.cs code file.
来源:https://stackoverflow.com/questions/61114448/kentico-not-able-to-save-the-datetime-in-dd-mm-yyyy-format