Returns a value indicating whether the specified date and time is within the specified daylight saving time period. - CSharp System

CSharp examples for System:DateTime

Description

Returns a value indicating whether the specified date and time is within the specified daylight saving time period.

Demo Code

// Licensed under MIT License (MIT) (https://github.com/zzzprojects/Z.ExtensionMethods)
using System.Globalization;
using System;//from   ww  w.j a v a2  s. c  o  m

public class Main{
        /// <summary>
    ///     Returns a value indicating whether the specified date and time is within the specified daylight saving time
    ///     period.
    /// </summary>
    /// <param name="time">A date and time.</param>
    /// <param name="daylightTimes">A daylight saving time period.</param>
    /// <returns>true if  is in ; otherwise, false.</returns>
    public static Boolean IsDaylightSavingTime(this DateTime time, DaylightTime daylightTimes)
    {
        return TimeZone.IsDaylightSavingTime(time, daylightTimes);
    }
}

Related Tutorials