I'm using a WSDL that expects a DateTime parameter for one of the methods. When .NET serializes my call, it creates a date parameter like this:
2010-1-1T10:00:00.00
This looks like the serializer is using a date format of "s". I need a different format, namely one with the timezone offset:
2010-1-1T10:00:00.00 -4:00
How do I specify the date format I want the serializer to use? (C# or VB.NET)
If the timezone offset is for your current timezone, you should check that your DateTime instance has its Kind
property set to DateTimeKind.Local
. If not, you can force it as follows:
DateTime myDateTime;
...
myDateTime = myDateTime.SpecifyKind(myDateTime, DateTimeKind.Local);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With