error: String was not recognized as a valid DateTime. RRS feed

  • Question

  • hi guys,

    my windows regional settings are UK(dd/MM/yyyy) and sharepoint settigns are also set to locale(UK) and GMT.

    when i try to programatically store value to list during my workflow using:


    workflowProperties.Item["Period_x0020_End"] = DateTime.Today.AddMonths(Int32.Parse(workflowProperties.InitiationData.ToString())).ToString();


    i get error that String was not recognized as a valid DateTime. but it is dd/MM/yyyy. what is the issue?

    Tuesday, August 16, 2011 7:10 AM


  • Are you sure that the date is properly created?

    And one more question - if workflowProperties.Item["Period_x0020_End"] is a date field, why do you want to convert its value to string and then save it? It is safer to pass the value as date time object, and then SharePoint will take care of all the conversions that are needed.

    Tuesday, August 16, 2011 7:50 AM

All replies