Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Does not work on Xamarin.Android (cs-cz locale)
- // - returns 8:00 instead of correct 9:00 (system time on the phone)
- DateTime now1 = DateTime.Now;
- DateTime now2 = DateTime.Now.ToLocalTime();
- // Working solution:
- DateTime nowutc = DateTime.UtcNow;
- DateTime correctedNow = TimeZoneInfo.ConvertTime(nowutc, TimeZoneInfo.Utc,
- TimeZoneInfo.FindSystemTimeZoneById(TimeZoneInfo.Local.Id));
Advertisement
Add Comment
Please, Sign In to add comment