Search Issue Tracker

Fixed in 2018.2.X

Fixed in 2017.3.X, 2018.1.X

Votes

27

Found in

2017.1.0f3

Issue ID

943047

Regression

No

Projects built with .NET 4.6, DateTime.Now always returns current UTC time regardless of your current local time

Scripting

-

Reproduction steps:
1) Download and open TimeTest.zip project
2) Build and run "TimeTest1.unity" scene on an Android device
-- Notice that time printed is not same as device's current time (few hours difference)

Note: Issue is not reproducible with .NET 3.5 Scripting Runtime Version.

Reproduced with:
2017.3.0a4, 2017.2.0b7, 2017.1.0p4, 2017.1.0a3
5.5 and older versions do not support .NET 4.6 Scripting Runtime Version

Devices under testing:
Samsung Galaxy S7, Android 6.1
LG Nexus 5x, Android 7.0
Samsung Galaxy S4, Android 4.2.2
LG G3, Android 5.0
iPhone SE, iOS 9.3

Not reproducible on Standalone
Reproduced on Android and iOS

Fixed in: 2017.4.1f1, 2018.1.0b12, 2018.2.0a1

Comments (21)

  1. mkderoy

    Jan 10, 2018 19:36

    I just wanted to give an update to people waiting on this ticket. A fix is on its way, but in the meantime I've provided a workaround (only works with il2cpp players) here on the forums. Hopefully this helps you be productive while the fix gets landed.
    https://forum.unity.com/threads/datetime-now-is-incorrectly-returning-utcnow-in-net-4-6-version.505347/#post-3307564

  2. moldywarpe

    Dec 05, 2017 22:06

    Still no progress on this one Unity......
    Bumping to hopefully get this resolved as it is a major problem for us :(

  3. TapSlots

    Nov 22, 2017 02:01

    Unfortunately this makes Unity's .Net 4.6 completely unusable. We just went through a migration for 4.6 upgraded a lot of 3rd party libraries and began using some of the new syntax only to find that our iOS notifications all schedule on UTC time. Now, we could hack around this using our own native notifications plugin, or offset the timing knowing that DateTime.Now is messed up. However since iOS Notification Services is a Unity first party supported system, and it broke with this change, my trust has been broken. I cannot trust that there aren't other places that Unity is using DateTime.Now internally that are causing issues that haven't surfaced to us.

    I expect that the official answer will be to hide behind the "Experimental" tag on .Net 4.6, but it seems like with every Unity upgrade something fundamental breaks.

  4. CptDustmite

    Nov 20, 2017 04:54

    Confirm this is happening for us on 2017.2.0f2 - this is a major bug as many of our features rely on local user time.

    Only happens on device, not Editor.

  5. f_sh

    Oct 29, 2017 02:55

    Same here.

    Device
    iPhone 7, iOS 11.0

    TimeZone.CurrentTimeZone returns UTC.
    Not correct Local Timezone.

  6. cyliax

    Sep 14, 2017 07:35

    Same here. we need to build with 4.6 and even with 2017.1.1f1 DateTime.Now is not working as expected on mobile devices.

Add comment

Log in to post comment