vbscript rfc822 date

vbscript rfc822 date

Function RFC822(d)
    ' Date: Mon, 26 Dec 2011 12:58:33 GMT
    Dim a, b
    a = Split("Mon,Tue,Wed,Thu,Fri,Sat,Sun", ",")
    b = Split("Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec", ",")
    Dim tmp
    tmp = a(Weekday(d, 2) - 1) & ", " & _
        Right("0" & Day(d), 2) & " " & _
        b(Month(d) - 1) & " " & _
        Year(d) & " " & _
        Right("0" & Hour(d), 2) & ":" & _
        Right("0" & Minute(d), 2) & ":" & _
        Right("0" & Second(d), 2) & " GMT"
    RFC822 = tmp
End Function

' usage: Response.AddHeader "Last-Modified", RFC822(dateadd("h",-1,now))
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s