PowerBuilder
PowerBuilder
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 PowerBuilder Downloads
integer li_rc
integer li_Success
oleobject loo_Mime
string ls_Now
string ls_Head
li_Success = 0
loo_Mime = create oleobject
li_rc = loo_Mime.ConnectToNewObject("Chilkat.Mime")
if li_rc < 0 then
destroy loo_Mime
MessageBox("Error","Connecting to COM object failed")
return
end if
li_Success = loo_Mime.SetBodyFromPlainText("Message with a Date header.")
if li_Success = 0 then
Write-Debug loo_Mime.LastErrorText
destroy loo_Mime
return
end if
// 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
ls_Now = loo_Mime.CurrentDateTime
Write-Debug "Current date/time: " + ls_Now
// It can be used to populate a Date header field.
loo_Mime.SetHeaderField("Date",ls_Now)
ls_Head = loo_Mime.GetEntireHead()
if loo_Mime.LastMethodSuccess = 0 then
Write-Debug loo_Mime.LastErrorText
destroy loo_Mime
return
end if
Write-Debug ls_Head
destroy loo_Mime