MasoodAd...@gmail.com wrote:
Hi,
I have to know if the passed date to my method is more then 13 months
old then the today's date. How would I do that?
If I do this
TimeSpan dtDiff = dtNow.Subtract(dtSales);
and check dtDiff.Days then it won't be accurate.
Well observed; because a TimeSpan is just a number of days; it doesn't
understand months. The only relevant thing that understands months is
DateTime itself, so we must look to that.
If we consider dtNow.AddMonths(-13), that is the cutoff date we are
interested in, with all the month calculations handled for us. DateTime
overloads the comparison operators, so we are done.
--
Larry Lard
Replies to group please