Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9236303
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T07:15:35+00:00 2026-06-18T07:15:35+00:00

When I change the time zone on my computer (when testing on the simulator)

  • 0

When I change the time zone on my computer (when testing on the simulator) or on the phone (when testing directly on the phone), DateTime.ToLocalTime() does not return updated results.

I register and successfully receive notification events for UIApplication.Notifications.ObserveSignificantTimeChange. In it I call TimeZoneInfo.ClearCachedData() which allows me to detect the time zone has in fact changed but this has no effect on ToLocalTime(). The DateTime I am converting is definitely of kind Utc (tried DateTime.UtcNow for example).

I tried calling CultureInfo.CurrentCulture.ClearCachedData() as suggested in this question: SetTimeZoneInformation does not update DateTime.Now for another .NET Application. That only causes the application to crash when the CurrentCulture is nulled.

Digging a bit deeper into the implementation of ToLocalTime(), it seems to use the object TimeZone.CurrentTimeZone. This object is reset only when the difference between DateTime.GetNow() and TimeZone.timezone_check. I suspect that TimeZone.timezone_check is not getting updated when TimeZoneInfo.ClearCachedData() is called.

Is there any way I can force ToLocalTime() to take into consideration the time zone change?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T07:15:36+00:00Added an answer on June 18, 2026 at 7:15 am

    You can use DateTimeOffset for this. See also this question.

    Edit – What I have working is this:

    var dateTimeUtc = new System.DateTime(2013, 2, 4, 21, 30, 0, 
                                            System.DateTimeKind.Utc);
    var dateTimeOffsetLocal = new System.DateTimeOffset(dateTimeUtc.ToLocalTime());
    var formattedLocalTime = string.Format("{0:HH:mm}", dateTimeOffsetLocal);
    

    On my phone my formattedLocalTime changes whenever I change my TimeZone on it, without clearing any cache. I do have to reload the view, but no other tricks.

    To display/verify the local TimeZone I use:

    var localTimeZone = System.TimeZoneInfo.Local.StandardName;
    

    I hope this somehow points you in the right direction. I don’t have any better than this “works on my machine(s)”-anwer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How do I change time and time zone in the iPhone simulator?
I am trying to implement time zone change in broadcast receiver but its not
How should change the date/time settings of the Android mobile phone through Android programming.
How to change the time zone from pst8pdt to gmt in cocoa
I need to change the emulator's default time zone. It worked in command line
I have unix timestamps from time zone X which is not known, the current
I am using DateTime.ToLocalTime() to convert dates from UTC to local time. My time
currently i'm attempting to using a switch statement to change between time zone with
I want to change default time zone so it's our local European/Prague - because
In Rails 3.0.10 I'm using Time.zone to change how a user sees times of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.