Sample code for 30+ languages & platforms
Classic ASP

MIME CurrentDateTime Property

See more MIME Examples

Demonstrates the read-only CurrentDateTime property, which returns the current local date and time formatted as an Internet message date including the numeric UTC offset. The example uses it to populate a Date header field.

Background. Internet message dates follow the RFC 5322 format, for example Fri, 21 Nov 1997 09:55:06 -0600. CurrentDateTime produces a value in that form for use in message headers.

Chilkat Classic ASP Downloads

Classic ASP
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
success = 0

set mime = Server.CreateObject("Chilkat.Mime")
success = mime.SetBodyFromPlainText("Message with a Date header.")
If (success = 0) Then
    Response.Write "<pre>" & Server.HTMLEncode( mime.LastErrorText) & "</pre>"
    Response.End
End If

'  CurrentDateTime returns the current local date and time formatted as an Internet message date,
'  including the numeric UTC offset, for example: Fri, 21 Nov 1997 09:55:06 -0600
now = mime.CurrentDateTime
Response.Write "<pre>" & Server.HTMLEncode( "Current date/time: " & now) & "</pre>"

'  It can be used to populate a Date header field.
success = mime.SetHeaderField("Date",now)

head = mime.GetEntireHead()
If (mime.LastMethodSuccess = 0) Then
    Response.Write "<pre>" & Server.HTMLEncode( mime.LastErrorText) & "</pre>"
    Response.End
End If

Response.Write "<pre>" & Server.HTMLEncode( head) & "</pre>"

%>
</body>
</html>