Given the following:
DateTime.ParseExact(timeStamp, "yyyyMMdd-HH:mm:ss.fff", System.Globalization.CultureInfo.InvariantCulture);
How do you specify that the given time is UTC? Right now the result is giving it my current timezone.
Add DateTimeStyles.AssumeUniversal
, since it's not specified in the format.
DateTime.ParseExact(timeStamp, "yyyyMMdd-HH:mm:ss.fff", System.Globalization.CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal);
You can include the timezone offset at the end of the parse string like so
DateTime.Parse("2011-01-01 12:00:00-5:00")
http://msdn.microsoft.com/en-us/library/1k1skd40.aspx
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