Between 2 dates, detecting todays date (if in between range)

Hi all, first of all sorry if is this is miscategorized. It was the closest area I could think to ask a VBscript question. Full disclaimer, I am super knew at VBscript. But I have a jQuery background; I’ve gotten this far from research, but still not there. With the below code, I’m trying to articulate a date range; May 10 - June 8th. I’m outputting a unique thumbnail per date in this range; I need to also detect, within this range, todays date. As a .today style class will be appending for today’s date. I achieved this previously when the date range was just within one month, 1 - 31 (and that code is under the most recent attempt / which is original code) this same code could not work because now it’s not as simple as 1 - 31 and declaring the month name statically, now it’s two months and 10 - 31 and then 1 - 8.

<%
Dim d1 As New Date(2015, 5, 10)
Dim d2 As New Date(2015, 6, 8)

Dim DaysBetween As Long = DateDiff(DateInterval.Day, d1, d2)

Dim d3 As Date

For d As Long = 0 To DaysBetween
    d3 = d1.AddDays(d)
    If d3 < Today() Then
	time = "past"
    ElseIf d3 = Today Then
	time = "today"
    Else
	time = "future"
    End If

    Dim suffix As String = Suffixer(d3.Day)

	response.write("<section id='day_"& i &"' class='calSquare  " & time &"'><article class='dateImage' style='background-image: url(images/Calendar_Thumbnails/Day_"&i&".jpg)'></article></article><article class='dateTitle'> "&i&suffix&"</article></section>")

	Next
	<!--response.write(products(0))-->
%>

Original functional code; articulating one month.

<%

		For i = 1 to 31
		dim time
		If i < day_part Then
		time = "past"
		ElseIf i = day_part Then
		time = "today"
		Else
		time = "future"
		End If
		
		suffix = Suffixer(i)

		response.write("<section id='day_"& i &"' class='calSquare  " & time &"'><article class='dateImage' style='background-image: url(images/Calendar_Thumbnails/Day_"&i&".jpg)'></article></article><article class='dateTitle'>May "&i&suffix&"</article></section>")

		Next
		<!--response.write(products(0))-->
	%>

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.