কম্পিউটার টিউটোরিয়াল

C#-এ DateTime.IsDaylightSavingTime() মেথড

সিনট্যাক্স

public bool IsDaylightSavingTime ();

উদাহরণ

using System; 
public class Demo { 
    public static void Main() { 
        DateTime d = new DateTime(2019, 10, 11, 7, 10, 40); 
        bool res = d.IsDaylightSavingTime(); 
        if (res) 
            Console.WriteLine("TRUE: This instance of DateTime is within the daylight saving time range for the current time zone."); 
        else 
            Console.WriteLine("FALSE: This instance of DateTime is within the daylight saving time range for the current time zone."); 
    } 
}

আউটপুট

FALSE: This instance of DateTime is within the daylight saving time range for the current time zone.

আরেকটি উদাহরণ (Now)

using System; 
public class Demo { 
    public static void Main() { 
        DateTime d = DateTime.Now; 
        bool res = d.IsDaylightSavingTime(); 
        if (res) 
            Console.WriteLine("TRUE: This instance of DateTime is within the daylight saving time range for the current time zone."); 
        else 
            Console.WriteLine("FALSE: This instance of DateTime is within the daylight saving time range for the current time zone."); 
    } 
}

আউটপুট

FALSE: This instance of DateTime is within the daylight saving time range for the current time zone.
  1. C#-এ DateTime.Subtract() মেথড: তারিখ বা টাইমস্প্যান বিয়োগ করা

  2. C#-এ DateTime.AddYears() পদ্ধতি

  3. C#-এ DateTime.AddHours() মেথড

  4. C#-এ DateTime.AddDays() মেথড