Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

asp.net mvc textbox date format

Tags:

asp.net-mvc

My form contains a textbox for date input. When submitted the data is used to add a row to the table. The view is strongly typed to the table.

The problem is that the database server is configured with US date format. But the users need to use UK date format in the textbox. When users enter uk date format error is thrown.

The database server configuration cannot be changed. So what can be done so that users can enter date in uk format?

like image 450
maX Avatar asked Feb 26 '26 16:02

maX


1 Answers

Try setting the culture in web.config:

<system.web>
    <globalization 
        requestEncoding="utf-8" 
        responseEncoding="utf-8" 
        culture="en-GB" 
        uiCulture="en-GB"/>
</system.web>
like image 153
Darin Dimitrov Avatar answered Mar 02 '26 15:03

Darin Dimitrov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!