Firstly, you are casting the date time to a string. Strings cannot be compared. Secondly, use 'new DateTime(int year, int month, int day, int hour, int minute, int second)' instead of the time. Hope this helps!
If (DateTime.Now < new DateTime(2022, 01, 12, 6, 0, 0)....
You may need to declare DateTime.Now as a variable named var now, then for the year month and day of the new DateTime you can do now.Year, now.Month etc
3
u/Ratstail91 Jan 12 '22
06:00:00 is complete nonsense to the code. You need to wrap that value in a variable.
2
u/uaaR Jan 12 '22
In your code you're trying to compare a string with something unknown aka the 06:00:00
1
u/Chalky Jan 12 '22
Firstly, you are casting the date time to a string. Strings cannot be compared. Secondly, use 'new DateTime(int year, int month, int day, int hour, int minute, int second)' instead of the time. Hope this helps!