C# TimeZoneInfo IsAmbiguousTime(DateTime)

Description

TimeZoneInfo IsAmbiguousTime(DateTime) 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(DateTime) has the following syntax.


public bool IsAmbiguousTime(
  DateTime dateTime
)

Parameters

TimeZoneInfo.IsAmbiguousTime(DateTime) has the following parameters.

  • dateTime - A date and time value.

Returns

TimeZoneInfo.IsAmbiguousTime(DateTime) method returns true if the dateTime parameter is ambiguous; otherwise, false.

Example


/*from  w  w  w.  j  a v  a 2  s.c  o  m*/
using System;
public class MainClass{
  public static void Main(String[] argv){  
    DateTime baseTime = new DateTime(2014, 11, 4, 0, 59, 00, DateTimeKind.Unspecified);
    DateTime 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