Android Datetime.Now is wrong

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.

Any idea why this is happening?

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.

Yeah .NET 4.6 is broken. I tried for awhile to figure it out but no success. Going back to 3.5 was fine for me though.

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.

Is there any work around for this?

Hey guys, you really need to fix this! System Time is really important!

Hello. : )

The issue can be tracked here:

It was fixed in 2017.4.1f1, 2018.1.0b12 and 2018.2.0a1. I updated issuetracker to reflect this : )

For older versions please refer here:

Cheers,
Evaldas