Export (0) Print
Expand All
0 out of 1 rated this helpful - Rate this topic

TimeZoneNotFoundException Class

The exception that is thrown when a time zone cannot be found.

Namespace:  System
Assembly:  System.Core (in System.Core.dll)
[SerializableAttribute]
[HostProtectionAttribute(SecurityAction.LinkDemand, MayLeakOnAbort = true)]
public class TimeZoneNotFoundException : Exception
NoteNote:

The HostProtectionAttribute attribute applied to this type or member has the following Resources property value: MayLeakOnAbort. The HostProtectionAttribute does not affect desktop applications (which are typically started by double-clicking an icon, typing a command, or entering a URL in a browser). For more information, see the HostProtectionAttribute class or SQL Server Programming and Host Protection Attributes.

This exception is thrown by the ConvertTimeBySystemTimeZoneId and FindSystemTimeZoneById methods when a time zone identifier cannot be found on the local system, or when there is no data associated with a particular time zone identifier.

Because the registry serves as the repository of time zone information in Windows XP and Windows Vista, this exception indicates that the registry contains no information about a particular time zone. Time zone information is stored in the subkeys of HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Time Zones.

If an application depends on the presence of a particular time zone and the attempt to retrieve it throws a TimeZoneNotFoundException, the application can handle the exception in either of two ways:

See the examples for the TimeZoneInfo.CreateCustomTimeZone(String, TimeSpan, String, String, String, TimeZoneInfo.AdjustmentRule[], Boolean) and FromSerializedString methods.

System.Object
  System.Exception
    System.TimeZoneNotFoundException
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.