I have a date that is in a format called \'String(Generalized-Time)\', see MSDN linked here , I need to check if this date is today and if it is do X.
To complicate thi
if(DateTime.Parse(yourString).Date == DateTime.Now.Date )
{
//do something
}
Should see if the day is today. However this is missing error checking (it assumes yourString is a valid datetime string).
To do the more complicated check you could do:
DateTime date = DateTime.Parse(yourString);
int dateOffset = 4;
if(date.Date >= DateTime.Now.AddDays(-dateOffset).Date)
{
//this date is within the range!
}