- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
DateTime.IsDaylightSavingTime() Method in C#
The DateTime.IsDaylightSavingTime() method in C# is used to indicate whether this instance of DateTime is within the daylight saving time range for the current time zone.
Syntax
Following is the syntax −
public bool IsDaylightSavingTime ();
Example
Let us now see an example to implement the DateTime.IsDaylightSavingTime() method −
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."); } }
Output
This will produce the following output −
FALSE: This instance of DateTime is within the daylight saving time range for the current time zone.
Example
Let us now see another example to implement the DateTime.IsDaylightSavingTime() method −
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."); } }
Output
This will produce the following output −
FALSE: This instance of DateTime is within the daylight saving time range for the current time zone.
Advertisements