Click here to Skip to main content
15,890,690 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear sir/ma'am

i am developing a website the problem is that at client side date insert in my database as MM/dd/yyyy
format
but at server side the date insert in dd/MM/yyyy format so that at server website perform properly
but at client side when i select date as 26/06/2013

it shows exception as string not recognised as valid date time .
help me regarding this
Posted
Updated 6-Jun-13 21:31pm
v2
Comments
Thanks7872 6-Jun-13 7:23am    
cant you notice something?You are passing 26/06/2013,it sees 26 as month and throws the error.The solution is,convert this value to 06/26/2013 before processing.
Mas11 6-Jun-13 7:53am    
Change your client side date format as 'dd/MM/yyyy' & issue resolved !
ankur789 7-Jun-13 2:56am    
sir AT client side it is already in dd/MM/yyyy format

1 solution

As part of the http header, when a client makes a request, they pass up the culture information for their computer.

This culture information can be used to find the expected date format from the current user.

You need to research the use of culture information as correctly implementing this will allow you be ignorant of how the client inputs the date and automate converting it to your desired format.

Coding Best Practices Using DateTime in the .NET Framework[^]
 
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