[Please vote to close this – see my last comment.]
Hi,
Something like this:
DateTime.ParseExact("25/12/2008 00:00:00", "dd/MM/yyyy HH:mm:ss", CultureInfo.InvariantCulture);
works fine on my development machine but not after deployment (server).
I guess it has to do with some time zone configuration. I have tried:
<%@ ... UICulture="en" Culture="en-US" %>
with no avail. Any suggestions on a postcard please. Thanks.
Christian
PS: Exception:
String was not recognized as a valid DateTime
PPS: I have updated the question. I actually feed in the time bit. sorry about that!
PPPS:
I have now realised that all this has to do with Excel and oledb. The string 25/12/2008 looks like this “12/25/2008 12:00:00 AM” on the server and like this “25/12/2008 00:00:00” on the developement machine. I adjusted the time zone of the server to UK without avail. What else can I do? Thank and sorry about all this confusion!!!
You’d do better posting exactly what failed, and the exact error, rather than “something like” what failed.
I would expect your sample to give a FormatException, since the string you’re converting (“25/12/2008”, no time) does not match the format specified (“dd/MM/yyyy hh:mm:ss”).
Also a bit strange to be using hh rather than HH in your format – hh is a 12-hour clock.
I would expect any of the following to work.