OK, weird kind of problem.

In a WebApp, I have a WebProperty which is a DateTime which I'm WebGet-ing to a DateTime variable.

Under the debugger, it runs fine and I get "17/06/2022 13:18:32.534", but outside the debugger it throws an error, because in that case it is using a US date: "6/17/2022 1:08:36.602 PM".

I've tried ConverFromClient, but that throws an error under the debugger: "DateTime contains an invalid value", returning "00/00/17 00:00:00", which is obviously pretty confused (as indeed am I!).

What to do?

Addendum: think I might have cracked it. I:

  • WebGet it to a string
  • I then do ConvertToClient on it
  • Then I do ConvertFromClient
  • Then I move it to my DateTime variable

A bit round-the-houses, but it works (so far at least).