Server Error in '/' Application.

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:


Line 48:     public string DateFormat(string format, object dateline)
Line 49:     {
Line 50:         DateTime date = Convert.ToDateTime(dateline.ToString());
Line 51:         return date.ToString(format);
Line 52:     }

Source File: d:\web181\App_Code\Home\ArticleTemplate.cs    Line: 50

Stack Trace:


[FormatException: String was not recognized as a valid DateTime.]
   System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles) +10973474
   System.Convert.ToDateTime(String value) +83
   ArticleTemplate.DateFormat(String format, Object dateline) in d:\web181\App_Code\Home\ArticleTemplate.cs:50
   ArticleTemplate.DateFormat(Object dateline) in d:\web181\App_Code\Home\ArticleTemplate.cs:55

[MethodInvocationException: Invocation of method 'DateFormat' in  ArticleTemplate threw exception System.FormatException : String was not recognized as a valid DateTime.]
   NVelocity.Runtime.Parser.Node.ASTMethod.Execute(Object o, IInternalContextAdapter context) +978
   NVelocity.Runtime.Parser.Node.ASTReference.Execute(Object o, IInternalContextAdapter context) +447
   NVelocity.Runtime.Parser.Node.ASTReference.Render(IInternalContextAdapter context, TextWriter writer) +60
   NVelocity.Runtime.Parser.Node.SimpleNode.Render(IInternalContextAdapter context, TextWriter writer) +66
   NVelocity.Template.Merge(IContext context, TextWriter writer) +139
   Templates.Display(String templateName) in d:\web181\App_Code\Templates.cs:59
   Index.DetailPage() in d:\web181\index.aspx.cs:185
   Index.Page_Load(Object sender, EventArgs e) in d:\web181\index.aspx.cs:83
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +51
   System.Web.UI.Control.OnLoad(EventArgs e) +92
   System.Web.UI.Control.LoadRecursive() +54
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +772


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34209