Creates a custom time zone with a specified identifier, an offset from Coordinated Universal Time (UTC), a display name, a standard time name, a daylight saving time name, daylight saving time rules, and a value that indicates whether the returned object reflects daylight saving time information.
Parameters
- id
- The time zone's identifier.
- baseUtcOffset
- A System.TimeSpan object that represents the time difference between this time zone and Coordinated Universal Time (UTC).
- displayName
- The display name of the new time zone.
- standardDisplayName
- The standard time name of the new time zone.
- daylightDisplayName
- The daylight saving time name of the new time zone.
- adjustmentRules
- An array of NTimeZoneInfo.AdjustmentRule objects that augment the base UTC offset for a particular period.
- disableDaylightSavingTime
- true to discard any daylight saving time-related information present in with the new object; otherwise, false.
Return Value
The new time zone. If the parameter is true, the returned object has no daylight saving time data.
Exception | Description |
System.ArgumentNullException | The parameter is null. |
System.ArgumentException | The parameter is an empty string ("").-or-The parameter does not represent a whole number of minutes. |
System.ArgumentOutOfRangeException | The parameter is greater than 14 hours or less than -14 hours. |
System.InvalidTimeZoneException | The adjustment rules specified in the parameter overlap.-or-The adjustment rules specified in the parameter are not in chronological order.-or-One or more elements in are null.-or-A date can have multiple adjustment rules applied to it.-or-The sum of the parameter and the NAdjustmentRule.DaylightDelta value of one or more objects in the array is greater than 14 hours or less than -14 hours. |
Target Platforms: Windows 11, Windows 10, Windows 7, Windows Server 2019, Windows Server 2016, Windows Server 2012 R2, Windows Server 2012, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later)