/// <summary> /// Gets the number of hours within a given day of the time zone, /// taking transitions into account. /// </summary> /// <remarks> /// The time part (hours, minutes, seconds, etc.) of /// <paramref name="date"/>, as well as whether its local or UTC, /// is ignored. /// </remarks> public static double HoursInDay(this TimeZoneInfo tz, DateTime date) { return(tz.GetDayLength(date).TotalHours); }
public void GetDayLength(double hours, int year, int month, int day, int hour, int minute) { Assert.Equal(TimeSpan.FromHours(hours), CustomTimeZone.GetDayLength(new DateTime(year, month, day, hour, minute, 0))); }