Hi,
On running my project at the first time in Visual Studio 2012 all the values I have entered will be inserted to database and the save process will be success. But after first run I could not run the same code, it shows an error message "String was not recognized as a valid DateTime".
Please help me
Loading

Anupam SinghPosted May 14, 2014, 8:38 AM
Renjith V SPosted May 14, 2014, 8:22 AM
I have got the solution for my problem. Its the date picker date format problem. I have used a date picker plugin for adding calender in the text box. Its default format is MM/dd/yyyy. But I need to pass the date in the dd/MM/yyyy format. So I need to change the format there by using the below code.
$("#txtAddedDate").datepicker({dateformat : "dd/mm/yyyy"});
Thanks for the Support Anupam.
Anupam SinghPosted May 14, 2014, 7:25 AM
Seems time is not being consider.
go to the article here
written by mahesh sir. and I am sure you wont need more help in this.
Renjith V SPosted May 14, 2014, 7:14 AM
Its the problem of date format in some function it is mm/dd/yyyy format and in somewhere its in dd/mm/yyyy format. I need to change the format to same for all places.
Abhay ShankerPosted May 14, 2014, 3:08 AM
objInfoBO.AddedDate = date ;
Also check date format in string
Renjith V SPosted May 14, 2014, 1:08 AM
I am saving this time in my table details column name AddedDate and it is declared as datetime. In my project I am using JSON to pass the values. In my aspx page I declared variable using JSON and in aspx.cs page I have used parameter string AddedDate and the value will be get as
"objInfoBO.AddedDate = Convert.ToDateTime(AddedDate); ".
Renjith V SPosted May 14, 2014, 1:02 AM
In my project I have used a parameter as string AddedDate and I am using a table details, this table include AddedDate and other columns. I am using JSON to pass the value entered in the text box AddedDate and it will be stored in the SQL database as well. But when ever I tried today's date or 2 days before today, it will show the described error.
Anupam SinghPosted May 14, 2014, 12:58 AM
Renjith V SPosted May 14, 2014, 12:52 AM
Can you please explain the solution. If I use nearby date of today the error will be occured otherwise its fine.
Anupam SinghPosted May 14, 2014, 12:49 AM
It may be because of Globalization .Because I have faced the same issue a long time back that I was using different culture(settings).
Abhay ShankerPosted May 14, 2014, 12:43 AM
Renjith V SPosted May 14, 2014, 12:30 AM