System.TimeZoneInfo.GetAmbiguousTimeOffsets C# (CSharp) Method

GetAmbiguousTimeOffsets() public method

public GetAmbiguousTimeOffsets ( DateTimeOffset dateTimeOffset ) : System.TimeSpan[]
dateTimeOffset DateTimeOffset
return System.TimeSpan[]
		public TimeSpan [] GetAmbiguousTimeOffsets (DateTimeOffset dateTimeOffset)
		{
			if (!IsAmbiguousTime (dateTimeOffset))
				throw new ArgumentException ("dateTimeOffset is not an ambiguous time");

			throw new NotImplementedException ();
		}

Same methods

TimeZoneInfo::GetAmbiguousTimeOffsets ( System.DateTime dateTime ) : System.TimeSpan[]

Usage Example

Esempio n. 1
0
        public static TimeSpan GetUtcOffset(DateTime dateTime, TimeZoneInfo timeZoneInfo)
        {
            // Unlike the default behavior of TimeZoneInfo.GetUtcOffset, it is prefered to choose
            // the DAYLIGHT time when the input is ambiguous, because the daylight instance is the
            // FIRST instance, and time moves in a forward direction.

            TimeSpan offset = timeZoneInfo.IsAmbiguousTime(dateTime)
                ? timeZoneInfo.GetAmbiguousTimeOffsets(dateTime).Max()
                : timeZoneInfo.GetUtcOffset(dateTime);

            return offset;
        }
All Usage Examples Of System.TimeZoneInfo::GetAmbiguousTimeOffsets