By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,162 Members | 1,038 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,162 IT Pros & Developers. It's quick & easy.

Date format base in form of aspx

P: 1
I have a form in ASP, where Date has to display in "dd/mm/yyyy" format. when I am saving that format into database its giving either error message or saving incorrect date. because sql used to insert dates in "dd/mm/yyyy" format.
say if date is 24 9 2007, in sql it will not save as "24/09/2007", it will be out of script range error and if date is 3 9 2007 , then sql will treat as 9 3 2007.
please find a solution for that.
Apr 10 '12 #1
Share this Question
Share on Google+
1 Reply


jhardman
Expert 2.5K+
P: 3,405
The problem is in the database, not the webpage. Microsoft is a US company, and the standard US date format is mm/dd/yyyy so your MS SQL Server is interpreting the date as if you are putting the month first even if the aspx page understands the correct format. The best solution is to use a non-ambiguous date format like "12-Mar-2012" or "March 12, 2012" both of which will always be recognized by the database. Alternatively, if you have access to the db you can change its regionalization settings, I would give you 20:1 odds it is set to US regionalization.

By the way, this is the classic asp forum, not the aspx forum. Check the menus above, we have both.

Jared
Apr 10 '12 #2

Post your reply

Sign in to post your reply or Sign up for a free account.