I need to convert DateTime+TimeZoneInfo into DateTimeOffset.
How do I do this? I assume I have to pass TimeSpan but then I'm not sure if daylight saving times will be handled properly..
TimeZoneInfo timeZone = TimeZoneInfo.FindSystemTimeZoneById("Mountain Standard Time"); return new DateTimeOffset(DateTime.UtcNow, timeZone.BaseUtcOffset);
This code throws exception..
The UTC Offset for Utc DateTime
instances must be 0.\r\nParameter
Sorry, I didn't realize that DateTimeOffset contains only offset, it doesn't contain actual zone information – so I'm accepting answer from @Dave as it is what I will be using..