Date and Time
Date and Time in C# are two commonly used data types. Both Date and Time in C# are represented using C# DateTime class. C# DateTime is a structure of value Type like int, double etc. It is available in System namespace and present in mscorlib.dll assembly.
CODE
EG 1 . Creating a DateTime object and accessing properties inside it.
class Program {
    static void main(){
        //DateTime.Now will store current date and time values to currentTime object.
        DateTime currentTime = DateTime.Now;
        Console.WriteLine(currentTime.Day);
        Console.WriteLine(currentTime.Minute);
        Console.WriteLine(currentTime.Year);
        Console.WriteLine(currentTime.Month);
        Console.WriteLine(currentTime.DayOfWeek);
        Console.WriteLine(currentTime.DayOfYear);
        Console.WriteLine(currentTime.TimeOfDay);
    }
}
EG 2 . Creating a line of code and making it work only for 48 hours
class Program {
    static void main(){
        //Date while writing this code 10/29/2022
        DateTime currentTime = DateTime.Now;
        if (currentTime.Year == 2022) {
            if (currentTime.Day <= 31 && currentTime.Month<=10) {
                Console.WriteLine("The Line of code");
            }
        }
    }
}
(Click Here, For more exercises)