The following tutorial and code will show how to convert to format a normal Date into RFC-822 Format Date using ASP(VBScript). These are required for various things but in particular they are required format for dates in RSS feeds.
<%
Function return_RFC822_Date(myDate, offset)
Dim myDay, myDays, myMonth, myYear
Dim myHours, myMonths, mySeconds
myDate = CDate(myDate)
myDay = WeekdayName(Weekday(myDate),true)
myDays = Day(myDate)
myMonth = MonthName(Month(myDate), true)
myYear = Year(myDate)
myHours = zeroPad(Hour(myDate), 2)
myMinutes = zeroPad(Minute(myDate), 2)
mySeconds = zeroPad(Second(myDate), 2)
return_RFC822_Date = myDay&", "& _
myDays&" "& _
myMonth&" "& _
myYear&" "& _
myHours&":"& _
myMinutes&":"& _
mySeconds&" "& _
offset
End Function
Function zeroPad(m, t)
zeroPad = String(t-Len(m),"0")&m
End Function
%>
You call return_RFC822_Date with a parsable date (by CDate) and a timezone or offset which complies with RFC822. The function attempts to parse the date value passed to it and it then generates the date in the correct format.
You would call the above functions like so:
<%=return_RFC822_Date("19/03/2003", "GMT")%>
<%=return_RFC822_Date(Now(), "GMT")%>
Output:Wed, 19 Mar 2003 00:00:00 GMT
Wed, 1 Dec 2004 19:21:03 GMT