DataFlex
DataFlex
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 DataFlex Downloads
Use ChilkatAx-win32.pkg
Procedure Test
Boolean iSuccess
Handle hoMime
String sNow
String sHead
String sTemp1
Boolean bTemp1
Move False To iSuccess
Get Create (RefClass(cComChilkatMime)) To hoMime
If (Not(IsComObjectCreated(hoMime))) Begin
Send CreateComObject of hoMime
End
Get ComSetBodyFromPlainText Of hoMime "Message with a Date header." To iSuccess
If (iSuccess = False) Begin
Get ComLastErrorText Of hoMime To sTemp1
Showln sTemp1
Procedure_Return
End
// 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
Get ComCurrentDateTime Of hoMime To sNow
Showln "Current date/time: " sNow
// It can be used to populate a Date header field.
Get ComSetHeaderField Of hoMime "Date" sNow To iSuccess
Get ComGetEntireHead Of hoMime To sHead
Get ComLastMethodSuccess Of hoMime To bTemp1
If (bTemp1 = False) Begin
Get ComLastErrorText Of hoMime To sTemp1
Showln sTemp1
Procedure_Return
End
Showln sHead
End_Procedure