Microsoft has also implemented the operators ‘<‘ and ‘>’. So you use these to compare two dates.
if (date1 < DateTime.Now)
Console.WriteLine("Less than the current time!");
More Related Contents:
- How do I calculate someone’s age based on a DateTime type birthday?
- DateTime vs DateTimeOffset
- Parse DateTime with time zone of form PST/CEST/UTC/etc
- String was not recognized as a valid DateTime ” format dd/MM/yyyy”
- Is DateTime.Now the best way to measure a function’s performance? [closed]
- Algorithm to detect overlapping periods [duplicate]
- C# DateTime.Now precision
- How to get difference between two dates in Year/Month/Week/Day?
- format date in c#
- How do I get the last day of a month?
- What does “DateTime?” mean in C#?
- Measuring code execution time
- Get Month name from month number
- How do I represent a time only value in .NET?
- Parse C# string to DateTime
- DateTime ToString issue with formatting months with “mm” specifier
- How do I get the AM/PM value from a DateTime?
- How to ensure a timestamp is always unique?
- How can I format DateTime to web UTC format?
- How frequent is DateTime.Now updated ? or is there a more precise API to get the current time?
- Convert String to Date in .NET if my incoming date format is in YYYYMMDD
- How to parse and generate DateTime objects in ISO 8601 format
- DateTime conversion from string C#
- DateTime.Parse(“2012-09-30T23:00:00.0000000Z”) always converts to DateTimeKind.Local
- Getting the first and last day of a month, using a given DateTime object
- Days, hours, minutes, seconds between two dates
- Convert Date from Persian to Gregorian
- Unix time conversions in C# [duplicate]
- .NET: Why is TryParseExact failing on Hmm and Hmmss?
- LINQ Query to Convert string to datetime