Is there a better .net way to check if a DateTime has occured 'today' then the code below?
if ( newsStory.WhenAdded.Day == DateTime.Now.Day &&
newsStory.WhenAdded.Month == DateTime.Now.Month &&
newsStory.WhenAdded.Year == DateTime.Now.Year )
{
// Story happened today
}
else
{
// Story didn't happen today
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…