How can I get datetime with timezone info (GMT/UTC +7)?
Let's say in real time it was 06:00 PM
and then someone alters the local PC time to 01:00 PM
. How do I get datetime 06:00 PM
?
I have tried this:
System.Globalization.CultureInfo.CurrentCulture.ClearCachedData();
DateTime utcTime = DateTime.UtcNow;
TimeZoneInfo tzi = TimeZoneInfo.FindSystemTimeZoneById("SE Asia Standard Time");
DateTime localTime = TimeZoneInfo.ConvertTimeFromUtc(utcTime, tzi);
Console.WriteLine(localTime);
But I still got 01:00 PM
.