DataFlex Requires Chilkat v11.0.0+
DataFlex
Read the sender’s Date in UTC and local time
See more Email Object Examples
Parse the Date header from an EML file, then print the same instant in UTC and the current computer’s local zone. Date is the time reported by the sender. For a relay timestamp, use a Received header.
Chilkat DataFlex Downloads
Use ChilkatAx-win32.pkg
Procedure Test
Boolean iSuccess
Handle hoEmail
String sDateHeader
Handle hoWhen
String sTemp1
Move False To iSuccess
// Assumes Chilkat is unlocked. See Global Unlock Sample.
Get Create (RefClass(cComChilkatEmail)) To hoEmail
If (Not(IsComObjectCreated(hoEmail))) Begin
Send CreateComObject of hoEmail
End
Get ComLoadEml Of hoEmail "message.eml" To iSuccess
If (iSuccess <> True) Begin
Get ComLastErrorText Of hoEmail To sTemp1
Showln sTemp1
Procedure_Return
End
Get ComGetHeaderField Of hoEmail "Date" To sDateHeader
Get Create (RefClass(cComCkDateTime)) To hoWhen
If (Not(IsComObjectCreated(hoWhen))) Begin
Send CreateComObject of hoWhen
End
Get ComSetFromRfc822 Of hoWhen sDateHeader To iSuccess
If (iSuccess <> True) Begin
Showln "Failed: when.SetFromRfc822."
Procedure_Return
End
Showln "Header: " sDateHeader
Get ComGetAsTimestamp Of hoWhen False To sTemp1
Showln "UTC: " sTemp1
Get ComGetAsTimestamp Of hoWhen True To sTemp1
Showln "Local: " sTemp1
End_Procedure