Sample code for 30+ languages & platforms
Xojo Plugin Requires Chilkat v11.0.0+

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 Xojo Plugin Downloads

Xojo Plugin
Dim success As Boolean
success = False

//  Assumes Chilkat is unlocked. See Global Unlock Sample.

Dim email As New Chilkat.Email
success = email.LoadEml("message.eml")
If (success <> True) Then
    System.DebugLog(email.LastErrorText)
    Return
End If

Dim dateHeader As String
dateHeader = email.GetHeaderField("Date")
Dim when As New Chilkat.CkDateTime
success = when.SetFromRfc822(dateHeader)
If (success <> True) Then
    System.DebugLog("Failed: when.SetFromRfc822.")
    Return
End If

System.DebugLog("Header: " + dateHeader)
System.DebugLog("UTC:    " + when.GetAsTimestamp(False))
System.DebugLog("Local:  " + when.GetAsTimestamp(True))