Date issue in asp.net c#

Posted by Bhavna81 under ASP.NET on 5/12/2010 | Views : 1043 | Status : [Member] | Replies : 2
Hello experts,
i m developing asp.net C# application with back end sql server 2000. in that i have one input box which contain date value in 'MM/dd/yyyy' format. and my system date format is 'dd/MM/yyyy' when i m trying to submit my page the following error is occur.

String was not recognized as a valid DateTime.

i found that its happen because of the date format difference of application and system. but i dont want to change my system as well as application date format because some other criteria. what can i do, so i dont have to change any of date format.

please help me...

thanks.




Responses

Posted by: Vuyiswamb on: 5/12/2010 [Member] [MVP] [Administrator] NotApplicable

Up
0
Down
Let me see the code that you use to pass the date, show me the line of code that gives you an error



Thank you for posting at Dotnetfunda
[Administrator]

Bhavna81, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Syedshakeer on: 5/12/2010 [Member] Starter

Up
0
Down
Hi,
use the code as follows:
[code]
string DTString;
DTString= "19/08/2010";
DateTime dt = Convert.ToDateTime(DTString);
Response.Write(dt.Day + "/" + dt.Month + "/" + dt.Year);
[/code]

Syed Shakeer Hussain

Bhavna81, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response