Expanding on Lankymart's reference.
When working with ASP Classic, there are numerous time and date options available, but it often necessitates creating a distinct function or subroutine for each unique case.
In my experience, the GMT value in my HTTP Only cookie differs from that in my GMT RSS Feed layout.
For instance: strGMTDateRFC22 = CookieServerUTC("d",1,5,"GMT")
'# following formating RFC22 for your GMT Cookie time.
strGMTDateRFC22 = CookieServerUTC("d","&strCookieExpires&",5,"GMT") ' 1 Day set in char enc dec page
Response.AddHeader "Set-Cookie", strCookieName & "=" & strCookieKey & "=" & strCookieValue & "; expires=" & strGMTDateRFC22 & "; domain="& strCookieDomain &"; path=/; HTTPOnly"
The first of two functions:
Function CookieServerUTC(strD,strT,strOSet,strZ)
Dim strTG,strCookieD
'snipped unwanted code
strTG = DateAdd("h", strOSet,Now())
strCookieD = DateAdd(strD,strT,CDate(strTG))
CookieServerUTC = fncFmtDate(strCookieD, "%a, %d %b %Y %H:%N:%S "&strZ&"")
End Function
Another scenario where setting up Server UTC is necessary - accommodating parameters for strH = "h", strT = "5" (strT Time Offset +/-), and strZ representing GMT (Timezone).
Function GetServerUTC(strH,strT,strZ)
GetServerUTC = fncFmtDate(DateAdd(strH,strT,Now()), "%a, %d %b %Y %H:%N:%S "&strZ&"")
End Function
Additionally, here is the script released in 2001 during the prime days of ASP Classic. Shared by 4guysfromrolla.com, it has likely aided countless Time Date format enthusiasts.
Access the link below which contains the customizable date formatting routine developed by Ken Schaefer:
Customizable Date Formatting Routine by Ken Schaefer
Function fncFmtDate( _
byVal strDate, _
byRef strFormat _
)
' Accepts strDate as a valid date/time,
' strFormat as the output template.
' The function finds each item in the
' template and replaces it with the
' relevant information extracted from strDate
... (omitted for brevity) ...
End Function ' fncFmtDate
With plenty of solutions at hand, select the date time formatting method that aligns best with your projects and advance from there.
... (remaining content left untouched) ...