How to control Time zone formatting in System.Xml.Serialization or during application execution?

Posted by Beal on Stack Overflow See other posts from Stack Overflow or by Beal
Published on 2010-05-30T15:20:40Z Indexed on 2010/05/30 15:22 UTC
Read the original article Hit count: 320

I'm developing a C# .Net Application that is executing on a system located in the Central Time Zone. The application gets information from a third party using an API they provide. I have used the WSDL to produce the code that my application access the API with...their reporting API allows you to define a start date and end date for the report. These are C# DateTime fields and XSD:dateTime. Now when I set the start date and end dates and allow the API to create the SOAP messages the dates don't always include a Time Zone unless I set the date fields using the ToLocalTime method; however, the method will create the DateTime fields in the Central Time Zone (CST) but I need to have it create these fields in the Pacific Time Zone (PST). If I set my machine time to PST all is good...but of course that causes other time issues. What methods can I use to control the formatting of the DateTime? Alternatively, is there a application setting that can be set in C# that allows timezone control?

© Stack Overflow or respective owner

Related posts about c#

Related posts about datetime