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.