SQL Server
SQL Server
Get and Set the Email Date (UTC/GMT)
See more Email Object Examples
Demonstrates the Chilkat Email.EmailDateStr property, which is the date/time from the Date header in the UTC/GMT timezone in RFC822 string form (for example, Fri, 10 Jul 2026 20:15:30 GMT). Setting this property updates the email's Date header. This example sets the date and reads it back.
Background: Every email carries a
Date header whose format is defined by the internet message standards (RFC 822 / RFC 5322), looking like Fri, 10 Jul 2026 20:15:30 +0000. This same instant in time can be written relative to GMT/UTC or relative to a local timezone offset. EmailDateStr gives you the GMT/UTC view, while LocalDateStr gives the local-timezone view of the very same header.Chilkat SQL Server Downloads
--
CREATE PROCEDURE ChilkatSample
AS
BEGIN
DECLARE @hr int
DECLARE @sTmp0 nvarchar(4000)
-- Demonstrates the Email.EmailDateStr property.
-- This is the date/time from the Date header in the UTC/GMT timezone,
-- in RFC822 string form. Setting it updates the email's Date header.
DECLARE @email int
EXEC @hr = sp_OACreate 'Chilkat.Email', @email OUT
IF @hr <> 0
BEGIN
PRINT 'Failed to create ActiveX component'
RETURN
END
EXEC sp_OASetProperty @email, 'EmailDateStr', 'Fri, 10 Jul 2026 20:15:30 GMT'
EXEC sp_OAGetProperty @email, 'EmailDateStr', @sTmp0 OUT
PRINT 'EmailDateStr = ' + @sTmp0
EXEC @hr = sp_OADestroy @email
END
GO