How to clear TimeZoneInfo cache in WinRT?

In .NET, some values โ€‹โ€‹used TimeZoneInfoare cached, such as the current time zone used TimeZoneInfo.Local, DateTime.ToLocalTimeetc. In traditional .NET Framework applications, this cache can be cleared by calling TimeZoneInfo.ClearCachedData(), as explained in the documents .

However, in WinRT applications, such as the Windows Store and Windows Universal Apps, the API is ClearCachedDatanot available.

How to clear timezone cache in WinRT environment?

+1
source share
1 answer

There is an undocumented way to achieve this, as shown here, in the .NET source .

TimeZoneInfo.ConvertTime(new DateTime(0), TimeZoneInfo.Utc);

, WinRT, .NET Framework (4.6+),.NET Core PCL.

Microsoft .NET, . , , , API, .

+4

Source: https://habr.com/ru/post/1691748/


All Articles