C
Curious
I have code below. But it won't compile.
Error:
Cannot implicitly convert type 'System.TimeSpan' to 'System.DateTime'
DateTime now = DateTime.Now.TimeOfDay;
DateTime openTime = Convert.ToDateTime("9:30:00");
if (now < openTime)
{
// Do nothing if it's before 9:30 AM
return;
}
Error:
Cannot implicitly convert type 'System.TimeSpan' to 'System.DateTime'
DateTime now = DateTime.Now.TimeOfDay;
DateTime openTime = Convert.ToDateTime("9:30:00");
if (now < openTime)
{
// Do nothing if it's before 9:30 AM
return;
}