C# DateTime IsDaylightSavingTime() Method

Beginner
5 min read
Updated: Nov 2026
3 examples
DateTime

Definition

In C#, DateTime.IsDaylightSavingTime() returns true when the date and time fall inside daylight saving time for the local time zone of the computer.

The answer depends on the machine. A date in July may be DST in New York but not in Mumbai. For other zones, ask a TimeZoneInfo object instead.

This is an instance member of System.DateTime. You call it on a DateTime value, such as dt.IsDaylightSavingTime(...). DateTime is a struct, so every value is copied and never changed in place.

Syntax

Call it on a DateTime value. It takes no arguments.

C#
DateTime dt = new DateTime(2026, 7, 1, 12, 0, 0);
bool dst = dt.IsDaylightSavingTime();   // uses TimeZoneInfo.Local

// For a specific zone:
bool inZone = someZone.IsDaylightSavingTime(dt);
CallWhat it does
dt.IsDaylightSavingTime()Is this value in DST in the local zone?
TimeZoneInfo.Local.IsDaylightSavingTime(dt)The same question, asked on the zone object.
zone.IsDaylightSavingTime(dt)Ask any TimeZoneInfo, not just the local one.

If the zone has no daylight saving time, the method always returns false. For a Utc value, the method first converts to local time, then checks.

Library declarations
C#
public bool IsDaylightSavingTime();

Parameters

ParameterDescription
NoneIsDaylightSavingTime() takes no parameters.

Return Value

Return ValueDescription
booltrue if the value is in daylight saving time in the local time zone; otherwise false.

C# Examples

Example 1 — Match TimeZoneInfo.Local

Show that the DateTime method and the zone method agree, whatever your time zone is.

C#
using System;

class Program {
    static void Main() {
        DateTime dt = new DateTime(2026, 7, 1, 12, 0, 0);
        bool a = dt.IsDaylightSavingTime();
        bool b = TimeZoneInfo.Local.IsDaylightSavingTime(dt);
        Console.WriteLine(a == b);
    }
}

How It Works

  1. Midsummer date. July 1 is a common DST date in the northern hemisphere.
  2. Two ways to ask. One call uses the DateTime method, the other uses the local TimeZoneInfo.
  3. They agree. The instance method simply asks the local zone, so the comparison is True.
  4. Do not print a or b. Their value would change from computer to computer; the comparison never does.

Example 2 — A Zone with DST Rules

Build a fixed demo zone (UTC-5 with US-style DST) and test summer and winter dates.

C#
using System;

class Program {
    static void Main() {
        var start = TimeZoneInfo.TransitionTime.CreateFloatingDateRule(
            new DateTime(1, 1, 1, 2, 0, 0), 3, 2, DayOfWeek.Sunday);
        var end = TimeZoneInfo.TransitionTime.CreateFloatingDateRule(
            new DateTime(1, 1, 1, 2, 0, 0), 11, 1, DayOfWeek.Sunday);
        var rule = TimeZoneInfo.AdjustmentRule.CreateAdjustmentRule(
            DateTime.MinValue.Date, DateTime.MaxValue.Date, TimeSpan.FromHours(1), start, end);
        TimeZoneInfo zone = TimeZoneInfo.CreateCustomTimeZone(
            "DemoEast", TimeSpan.FromHours(-5), "Demo East", "Demo Std", "Demo DST", new[] { rule });

        Console.WriteLine(zone.IsDaylightSavingTime(new DateTime(2026, 7, 1, 12, 0, 0)));
        Console.WriteLine(zone.IsDaylightSavingTime(new DateTime(2026, 1, 15, 12, 0, 0)));
    }
}

How It Works

  1. Start rule. DST begins on the second Sunday of March at 02:00.
  2. End rule. DST ends on the first Sunday of November at 02:00.
  3. Custom zone. CreateCustomTimeZone adds the rule to a base offset of UTC-5, so the result does not depend on your PC.
  4. July vs January. July 1 is inside the DST window (True); January 15 is not (False).

Example 3 — A Zone Without DST

Use TimeZoneInfo.Utc, which never has daylight saving time.

C#
using System;

class Program {
    static void Main() {
        DateTime summer = new DateTime(2026, 7, 1, 12, 0, 0);
        Console.WriteLine(TimeZoneInfo.Utc.IsDaylightSavingTime(summer));
        Console.WriteLine(TimeZoneInfo.Utc.SupportsDaylightSavingTime);

        DateTime utc = new DateTime(2026, 7, 1, 12, 0, 0, DateTimeKind.Utc);
        bool viaMethod = utc.IsDaylightSavingTime();
        bool viaZone = TimeZoneInfo.Local.IsDaylightSavingTime(utc.ToLocalTime());
        Console.WriteLine(viaMethod == viaZone);
    }
}

How It Works

  1. UTC zone. TimeZoneInfo.Utc has no daylight saving rules.
  2. Always false. Even a July date returns False in UTC.
  3. SupportsDaylightSavingTime. This property is False too, which explains the first line.
  4. Utc kind. For a Utc value, the DateTime method converts to local first, so it matches the local zone after ToLocalTime().

Frequently Asked Questions

It uses the local time zone of the machine. A date can be DST in one zone and not in another.
Use TimeZoneInfo.IsDaylightSavingTime(dt) on a zone from FindSystemTimeZoneById.
The value is converted to local time first, then checked against the local zone.
The method always returns false.
The real answer depends on the computer running the code, so a comparison or a custom zone gives a stable result.

Next: IsLeapYear()

Check if a year is a leap year (true or false) with System.DateTime.

IsLeapYear() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful