Chilkat Examples

ChilkatHOMEAndroid™AutoItCC#C++Chilkat2-PythonCkPythonClassic ASPDataFlexDelphi DLLGoJavaNode.jsObjective-CPHP ExtensionPerlPowerBuilderPowerShellPureBasicRubySQL ServerSwiftTclUnicode CUnicode C++VB.NETVBScriptVisual Basic 6.0Visual FoxProXojo Plugin

Tcl Examples
Web API Categories

ASN.1
AWS KMS
AWS Misc
Amazon EC2
Amazon Glacier
Amazon S3
Amazon S3 (new)
Amazon SES
Amazon SNS
Amazon SQS
Apple Keychain
Async
Azure Cloud Storage
Azure Key Vault
Azure Service Bus
Azure Table Service
Base64
Box
CAdES
CSR
CSV
Cert Store
Certificates
Cloud Signature CSC
Code Signing
Compression
DKIM / DomainKey
DNS
DSA
Diffie-Hellman
Digital Signatures
Dropbox
Dynamics CRM
EBICS
ECC
Ed25519
Email Object
Encryption
FTP
FileAccess
Firebase
GMail REST API
GMail SMTP/IMAP/POP
Geolocation
Google APIs
Google Calendar
Google Cloud SQL
Google Cloud Storage
Google Drive
Google Photos
Google Sheets
Google Tasks
Gzip
HTML-to-XML/Text
HTTP
HTTP Misc
IMAP
JSON
JSON Web Encryption (JWE)
JSON Web Signatures (JWS)
JSON Web Token (JWT)
Java KeyStore (JKS)
MHT / HTML Email
MIME
Microsoft Graph
Misc
NTLM
OAuth1
OAuth2
OIDC
Office365
OneDrive
OpenSSL
Outlook
Outlook Calendar
Outlook Contact
PDF Signatures
PEM
PFX/P12
PKCS11
POP3
PRNG
REST
REST Misc
RSA
SCP
SCard
SFTP
SMTP
SSH
SSH Key
SSH Tunnel
ScMinidriver
Secrets
SharePoint
SharePoint Online
Signing in the Cloud
Socket/SSL/TLS
Spider
Stream
Tar Archive
ULID/UUID
Upload
WebSocket
X
XAdES
XML
XML Digital Signatures
XMP
Zip
curl
uncategorized

 

 

 

(Tcl) Get Email Date/Time

Demonstrates getting the email "Date" header field in a CkDateTime object.

Note: This example requires Chilkat v11.0.0 or greater.

Chilkat Tcl Extension Downloads

Chilkat Tcl Extension Downloads

load ./chilkat.dll

set success 0

set email [new_CkEmail]

# Load a .eml file into the email object.
set success [CkEmail_LoadEml $email "/home/users/chilkat/eml/myEml.eml"]

set dtTime [new_CkDateTime]

CkDateTime_SetFromRfc822 $dtTime [CkEmail_emailDateStr $email]

# Once we have the CkDateTime object, we can get the date/time in many different formats:

# Get as a RFC822 GMT string:
set bLocalTime 0
puts [CkDateTime_getAsRfc822 $dtTime $bLocalTime]

# Get as an RFC822 string in the local timezone.
# (remember, the daylight savings that existed at the given time in the past is applied)
set bLocalTime 1
puts [CkDateTime_getAsRfc822 $dtTime $bLocalTime]

# Get as a 32-bit UNIX time (local or GMT..)
# The Unix time is number of seconds since the Epoch, 1970-01-01 00:00:00 +0000 (UTC). 
set unixTime [CkDateTime_GetAsUnixTime $dtTime $bLocalTime]
puts "Unix time: $unixTime"

# One can also get the as a "DtObj" object for accessing the individual
# parts of the date/time, such as month, day, year, hour, minute, etc.
# The DtObj can be obtained in the GMT or local timezone:
set dtObj [new_CkDtObj]

CkDateTime_ToDtObj $dtTime $bLocalTime $dtObj

if {[CkDateTime_get_LastMethodSuccess $dtTime] == 0} then {
    puts "This should never really happen!"
    delete_CkEmail $email
    delete_CkDateTime $dtTime
    delete_CkDtObj $dtObj
    exit
}

puts [CkDtObj_get_Day $dtObj]-[CkDtObj_get_Month $dtObj]-[CkDtObj_get_Year $dtObj] [CkDtObj_get_Hour $dtObj]:[CkDtObj_get_Minute $dtObj]:[CkDtObj_get_Second $dtObj]

delete_CkEmail $email
delete_CkDateTime $dtTime
delete_CkDtObj $dtObj

 

© 2000-2025 Chilkat Software, Inc. All Rights Reserved.