C# TimeZoneInfo IsAmbiguousTime(DateTimeOffset)

Description

TimeZoneInfo IsAmbiguousTime(DateTimeOffset) determines whether a particular date and time in a particular time zone is ambiguous and can be mapped to two or more Coordinated Universal Time (UTC) times.

Syntax

TimeZoneInfo.IsAmbiguousTime(DateTimeOffset) has the following syntax.


public bool IsAmbiguousTime(
  DateTimeOffset dateTimeOffset
)

Parameters

TimeZoneInfo.IsAmbiguousTime(DateTimeOffset) has the following parameters.

  • dateTimeOffset - A date and time.

Returns

TimeZoneInfo.IsAmbiguousTime(DateTimeOffset) method returns true if the dateTimeOffset parameter is ambiguous in the current time zone; otherwise, false.

Example


using System;/*  w  ww.  j av  a 2 s .  c o m*/
public class MainClass
{
    public static void Main(String[] argv)
    {
        DateTimeOffset baseTime = DateTimeOffset.Now;
        DateTimeOffset newTime;

        // Get Pacific Standard Time zone
        TimeZoneInfo pstZone = TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time");

        newTime = baseTime.AddMinutes(13);
        Console.WriteLine("{0} is ambiguous: {1}", newTime, pstZone.IsAmbiguousTime(newTime));
    }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System »




Array
BitConverter
Boolean
Byte
Char
Console
ConsoleKeyInfo
Convert
DateTime
DateTimeOffset
Decimal
Double
Enum
Environment
Exception
Guid
Int16
Int32
Int64
Math
OperatingSystem
Random
SByte
Single
String
StringComparer
TimeSpan
TimeZone
TimeZoneInfo
Tuple
Tuple
Tuple
Type
UInt16
UInt32
UInt64
Uri
Version