search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

String was not recognized as a valid DateTime.

Asked by Anonymous
16 years ago.

I am receiving the following error when attemping to run a page with the Scheduler control on it:
String was not recognized as a valid DateTime.

I have the DataSourceID set to an ObjectDataSource which returns data from a table adapter.The DataStartField and DataEndField are set to columns in the database that are of type DateTime. Is there some specific format that the date properties are looking for?

Comment posted by Dan Letecky
16 years ago.
The input data for start and end columns are converted to DateTime using Convert.ToDateTime(). Can you post the exception stack trace?
Comment posted by Anonymous
16 years ago.

String was not recognized as a valid DateTime.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.FormatException: String was not recognized as a valid DateTime.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[FormatException: String was not recognized as a valid DateTime.]
System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles) +2228162
System.DateTime.Parse(String s, IFormatProvider provider) +26
System.Convert.ToDateTime(String value) +86
DayPilot.Web.Ui.DayPilotScheduler.PerformDataBinding(IEnumerable retrievedData) +617
DayPilot.Web.Ui.DayPilotScheduler.OnDataSourceViewSelectCallback(IEnumerable retrievedData) +61
System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +29
DayPilot.Web.Ui.DayPilotScheduler.PerformSelect() +110
System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +70
System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82
System.Web.UI.WebControls.BaseDataBoundControl.OnPreRender(EventArgs e) +19
DayPilot.Web.Ui.DayPilotScheduler.OnPreRender(EventArgs e) +33
System.Web.UI.Control.PreRenderRecursiveInternal() +77
System.Web.UI.Control.PreRenderRecursiveInternal() +161
System.Web.UI.Control.PreRenderRecursiveInternal() +161
System.Web.UI.Control.PreRenderRecursiveInternal() +161
System.Web.UI.Control.PreRenderRecursiveInternal() +161
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1360

Comment posted by Dan Letecky
16 years ago.
I've added custom exception handling for loading DataStartField and DataEndField values. It shows what string was causing the problem in the exception message.
This fix will be included in the next release. If you want to test it now, contact me at daypilot @ annpoint.com and I will send it to you.
Comment posted by Anonymous
16 years ago.
Ok, I sent you an email. Thanks!
Comment posted by Anonymous
15 years ago.

Has this issue been fixed in newest version, DayPilot Pro 5.0?

Comment posted by Dan Letecky
15 years ago.

This error will happen when you try to assign a database column with values that are not convertible to DateTime to either DataStartField or DataEndField.

Please let me know if you believe the problem is somewhere else.

Comment posted by Anonymous
14 years ago.

Exception:

ASP .NET Error Exception Conversion from string "07-18-2009" to type 'Date' is not valid

Here is the solution....

muruganad.com/ASP.NET/ASP-.NET-Error-Exception-Conversion-from-string-07182009-to-type-Date-is-not-valid.html

Thanks!

Murugan Andezuthu Dharmaratnam


muruganad.com

Comment posted by DieterC
14 years ago.

Hi, i've got the same error using DayPilot Lite as the original poster of this topic

this is the error:

String was not recognized as a valid DateTime.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.FormatException: String was not recognized as a valid DateTime.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[FormatException: String was not recognized as a valid DateTime.]
System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles) +2835862
System.Convert.ToDateTime(String value) +98
DayPilot.Web.Ui.DayPilotCalendar.PerformDataBinding(IEnumerable retrievedData) +308
DayPilot.Web.Ui.DayPilotCalendar.OnDataSourceViewSelectCallback(IEnumerable retrievedData) +47
System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +31
DayPilot.Web.Ui.DayPilotCalendar.PerformSelect() +98
System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +73
System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82
System.Web.UI.WebControls.BaseDataBoundControl.OnPreRender(EventArgs e) +22
System.Web.UI.Control.PreRenderRecursiveInternal() +80
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842

my dates come from an oracle database and are stored as timestamps

does anyone know how to solve it?

i've tried the link in the post above me, but that solution doesn't work for me

thx in advance

Comment posted by vinod
12 years ago.

var dateString = "13/06/2011";
var aa = DateTime.ParseExact(dateString, "dd/MM/yyyy", CultureInfo.CurrentCulture);

Comment posted by Ken
10 years ago.

I have the same problem. The stack trace is shown below:

[FormatException: String was not recognized as a valid DateTime.]
System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles) +2850770
System.Convert.ToDateTime(String value) +98
DayPilot.Web.Ui.DayPilotCalendar.PerformDataBinding(IEnumerable retrievedData) +308
DayPilot.Web.Ui.DayPilotCalendar.OnDataSourceViewSelectCallback(IEnumerable retrievedData) +47
System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +31
DayPilot.Web.Ui.DayPilotCalendar.PerformSelect() +98
System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +73
System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82
System.Web.UI.WebControls.BaseDataBoundControl.OnPreRender(EventArgs e) +22
System.Web.UI.Control.PreRenderRecursiveInternal() +80
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.