locked
DateTime - Metro - TimeZone RRS feed

  • Question

  • Hi,

    I'm using DateTime.Now to display current time and date in my metro (windows 8) application (c# + winjs).

    When the user change the TimeZone, without close and reopen the application,  the DateTime.Now show the old time.

    (Works fine when the user close and reopen the app)

    How to get the correct time?

    Thanks

    Thursday, January 23, 2014 6:19 PM

Answers

  • I guess it has the same issue as changing culture on run time therefore, it is not possible yet with the current version of Windows 8.1

    In case you need to localize it, you can let me know and I will provide you the sample code snippet for that.

    Thanks

    Arafat

    Thursday, January 23, 2014 10:18 PM
  • Hi calca,

    Yes, I can reproduce the issue you are facing. I believe that we need a fresh time API but currently TimeZoneInfo.ClearCachedData is not available with WinRT.

    I would suggest you to notify the user that the current time zone has been changed, require them to restart the app by trigger a system event, while SystemTriggerType equals to TimeZoneChanged.

    Anyway I will try to report this as bug to some senior engineers.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.


    Wednesday, January 29, 2014 8:16 AM
    Moderator

All replies

  • Related: http://social.msdn.microsoft.com/Forums/windowsapps/en-US/731dfd25-e717-4a1c-bbf8-fc37cfc19fc0/a-bug-about-timezoneinfo-in-metro-app?forum=winappswithcsharp
    Thursday, January 23, 2014 6:23 PM
  • I guess it has the same issue as changing culture on run time therefore, it is not possible yet with the current version of Windows 8.1

    In case you need to localize it, you can let me know and I will provide you the sample code snippet for that.

    Thanks

    Arafat

    Thursday, January 23, 2014 10:18 PM
  • Araf, thanks you for the answer.

    We need to get DateTime.Now after the timeZone changed without restart application.

    Friday, January 24, 2014 10:00 AM
  • Hi calca,

    Yes, I can reproduce the issue you are facing. I believe that we need a fresh time API but currently TimeZoneInfo.ClearCachedData is not available with WinRT.

    I would suggest you to notify the user that the current time zone has been changed, require them to restart the app by trigger a system event, while SystemTriggerType equals to TimeZoneChanged.

    Anyway I will try to report this as bug to some senior engineers.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.


    Wednesday, January 29, 2014 8:16 AM
    Moderator