Problem with datetime

Oct 13, 2011 at 1:09 PM


I have problems creating and editing pages and widgets due to a problem with the datetime format:

'Arithmetic overflow error converting expression to data type datetime. The statement has been terminated. Edited: 13/10/2011 9:05:58 AM'

Yesterday (12/10/2011=October 12), the system was understanding  "December 10".  Obviously, today the system simply crashed.

Maybe this is trivial to solve... but I am not really a programmer and any hint will be greatly appreciated.

Thanks in advance!

Oct 13, 2011 at 1:33 PM

I found the following solution: In EditPage.cshtml, I provided the date format parameter to the DateTime.Now.ToString() function, as follows:

    if (IsPost){

        pName = Request["pName"];
        pTitle = Request["pTitle"];
        pText = Request.Unvalidated("pText");
        mTitle = Request["mTitle"];
        mDescription = Request["mDescription"];
        mKeywords = Request["mKeywords"];
        pMasterPage = Request["pMasterPage"];
        pEditDate = DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss tt");
        pBody = false;
        if(Request["pBody"] == "on"){
            pBody = true;

I will keep you posted if I find further problems.  I assume the same change needs to be done to EditWidget.cshtml, but I have not tested yet.


Oct 13, 2011 at 2:15 PM
Edited Oct 13, 2011 at 2:39 PM

That will work, but can you change the line to just:

DateTime.Now; and test it for me, thanks

Quick question: Where are you located ???





Oct 13, 2011 at 2:51 PM

pEditDate = DateTime.Now;

Also works well - thanks!

I am located in the US, but work with an international organization and we occasionally get problems with datetime formats across systems, etc