I'm have a site that will display a banner image based on the time of year.
My date ranges go from:
4/1 - 6/30
7/1 - 9/30
10/1-11/30
12/1 - 3/31
My script is below. The first three ranges work fine, but the last one spans
two different years. If it's 2007, the range will be 12/1/2007 - 3/31/2007.
Obviously, that won't work. And, when the year changes to 2008, none of the
date ranges will be true because the 12/1-3/31 range will now be 12/1/2008 -
3/31/2008.
I thought about incrementing the year for 3/31 based on the current year,
but if the current year is correct, I can't increment it.
Suggestions? Just not sure how to go about this.
Thanks!
Doug
if Date >= CDate("4/1/" & Year(Date)) AND Date <= CDate("6/30/" &
Year(Date)) then
Response.Write "<img src=""/images/display/Banner.jpg"" >"
elseif Date >= CDate("7/1/" & Year(Date)) AND Date <= CDate("9/30/" &
Year(Date)) then
Response.Write "<img src=""/images/display/Banner.jpg"" >"
elseif Date >= CDate("10/1/" & Year(Date)) AND Date <= CDate("11/30/" &
Year(Date)) then
Response.Write "<img src=""/images/display/Banner.jpg"" >"
elseif Date >= CDate("12/1/" & Year(Date)) AND Date <= CDate("3/31/" &
Year(Date)) then
Response.Write "<img src=""/images/display/Banner.jpg"" >"
end if