Showing the number of days until an annually recurring date

In this example I've used Christmas day as the annually recurring date.

All you need to do is to is ammend the recurring_date and the text Christmas day (on the two Response.Write lines) in the script below to your annually recurring date.

<%
Dim recurring_date, days_to_recurring_date
recurring_date="25/12/2006"
days_to_recurring_date = DateDiff("d",Date,recurring_date)

Do While days_to_recurring_date < 0
recurring_date = DateAdd("yyyy",1,recurring_date)
days_to_recurring_date = DateDiff("d",Date,recurring_date)
Loop

If DateDiff("d",Date,recurring_date) > 0 Then
Response.Write "It is " & days_to_recurring_date & " days until Christmas day."
Else
Response.Write "It is Christmas day today!"
End If
%>

The script will always output the number of days until next Christmas Day even if the recurring date you set is in the past.

Current script output: It is 9 days until Christmas day.