I want to generate the following DateTime format to XML:
2017-11-12T01:00:00-06:00
I am in the Eastern Standard Time zone which is -5
so when I do:
DateTime operatingDayLocal = DateTime.SpecifyKind(currentDate, DateTimeKind.Local);
the result is:
2017-11-12T01:00:00-05:00
I have to use the same DateTime format which is T00:00:00-00:00
but keeping the same time. I only want to change the offset of the DateTime so it can be generated to XML properly.
I tried this, but the time changes and the offset is gone:
DateTime operatingDayCentralTime = TimeZoneInfo.ConvertTime(currentDate, TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time"));
Which results to : 2017-11-12T00:00:00