Xbase++
Xbase++
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 Xbase++ Downloads
LOCAL nSuccess
LOCAL oMime
LOCAL cNow
LOCAL cHead
nSuccess := 0
oMime := CreateObject("Chilkat.Mime")
nSuccess := oMime:SetBodyFromPlainText("Message with a Date header.")
IF (nSuccess == 0)
? oMime:LastErrorText
oMime:destroy()
RETURN
ENDIF
// 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
cNow := oMime:CurrentDateTime
? "Current date/time: " + cNow
// It can be used to populate a Date header field.
oMime:SetHeaderField("Date", cNow)
cHead := oMime:GetEntireHead()
IF (oMime:LastMethodSuccess == 0)
? oMime:LastErrorText
oMime:destroy()
RETURN
ENDIF
? cHead
oMime:destroy()