I'm designing a SharePoint-hosted add-in declarative workflow. I'm calling a REST endpoint that returns me a DateTime value and I need to compare this date to current DateTime that I get using DateTime.UtcNow.

When looping thru my httpsend response, I've tried to:

  • Convert.ToDateTime(itemDate)
  • DateTime.Parser(itemDate)

but both throw error.

How can I get this working to compare dates?

enter image description here


I've found the error: there were a null value in one itemDate in the JSON response. So I simple did a String.IsNullOrEmpty(itemDate) and it worked.

  • what error u are getting? – Waqas Sarwar MVP May 18 '16 at 20:50
  • @WaqasSarwarMCSE, I found the problem. Inspected the exception, there were a null value in my dataset. A simple String.IsNullOrEmpt solved the issue. – egidiocs May 18 '16 at 21:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.