I have the following class
using System;
using System.Globalization;
namespace GenericSomething
{
public class Specific : Generic
{
public override bool DoSomething(string date)
{
DateTime newDate = DateTime.ParseExact(date, "yyyyMMdd", CultureInfo.InvariantCulture);
if (newDate.Date == DateTime.Now.Date)
return true;
else
return false;
}
}
}
When I'm debugging and i use "Add watch" on DateTime.Now.Date, i get
"DateTime does not exist in the current context."
And the condition is never satisfied even if the dates are the same.
Why is that is I'm including System?
Here a few things I saw;
DateTime (newDate) and int (DateTime.Now.Day) with == operator. You might need to use newDate == DateTime.Now instead.;) after your return statements.System.Globalization namespace for using CultureInfo class.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With