Let’s say it’s 6pm today on Tuesday, August 15th. I show DateTime.Now.To String() and DateTime.UtcNow.To String() in some txt fields. When I run the unity editor it shows the correct date and DateTime.Now as 6pm and dateTime.UtcNow as 10pm (est time zone). But when I build and run it on my HTC one android phone it shows the right date but shows the time as 22:00:00 for DateTime.Now as well as for DateTime.UtcNow. I don’t understand why the time isn’t showing correct on my android. Even if I manually change timezones in my phone and run the app it still shows 22:00:00. That should at least change it, but it doesn’t.
I filed a bug report (Case 943047) for this. If you build with Net 4.6, DateTime.Now doesn’t work correctly. If you build with Net 3.5, it works as it should.
OK cool, it works now. But I noticed using System.Globalization.CultureInfo.CurrentCulture.ClearCachedData(); doesn’t work for .NET 3.5. for I need a way to know if I am changing timezones and Timezoneinfo doesn’t work in .NET 3.5 either. Damn!
Bump, same here. Local and UTC time from DateTime.Now and UtcNow are always the same on Android (7). And TimeZone.CurrentTimeZone.StandardName is always UTC as well. I don’t get it, what’s wrong? Can’t go back to NET 3.5.
This is a major bug. We have already upgraded our project to the .NET 4.6 version and it’s too late to go back now. Many of our features rely on local user time.