In article <#t**************@TK2MSFTNGP11.phx.gbl>, TaeHo Yoo wrote:
I have a scheduling function and in that function I want to excute
something if today is the second last sunday of a month.
Off the top of my head, the easiest thing here would be to check
if the next sunday is still in the same month, but two weeks from
the date in question is not...
private bool CheckSecondLastSunday()
{
DateTime dt = DateTime.Now;
if( (dt.DayOfWeek == DayOfWeek.Sunday) &&
(dt.AddDays(7).Month == dt.Month) &&
(dt.AddDays(14).Month != dt.Month) )
return true;
else
return false;
}
--
David
dfoster at
hotpop dot com