If the years are the same, compare the months, if the years do not match, your year should be less than now:
var yourDate = ...; if((yourDate.Year == DateTime.Now.Year && yourDate.Month < DateTime.Now.Month) || yourDate.Year < DateTime.Now.Year) {
UPDATE:
To check if yourDate in a specific time range, use this:
var yourDate = ...; var lowerBoundYear = 2011; var lowerBoundMonth = 1; var upperBoundYear = 2012; var upperBoundMonth = 4; if(((yourDate.Year == lowerBoundYear && yourDate.Month >= lowerBoundMonth) || yourDate.Year > lowerBoundYear ) && ((yourDate.Year == upperBoundYear && yourDate.Month <= upperBoundMonth) || yourDate.Year < lowerBoundYear )) {
source share