GetDateFromString Method

Converts specified datetime string (which must have format of "Date" message header) into Date type.

You can use this method to parse Date property of the Message object or any other date specified in this format.

date = ObjectName.GetDateFromString(DateStr, [ToLocalTime])  
DateStr As String String containing date (for example, Date property value)  
ToLocalTime (optional) True by default, which means returned datetime is corrected to local timezone. If False, the datetime is returned in GMT (UTC) timezone  
Return value As Date Converted datetime value  

Usage example:

Dim Msg, dDateTime
'Using visual basic to create object
Set Msg = CreateObject("MailBee.Message")
'Using ASP to create object
'Set Msg = Server.CreateObject("MailBee.Message")
'In ASP use Response.Write instead of MsgBox
dDateTime = Msg.GetDateFromString("Sat, 1 Nov 2003 11:32:37 -0500", False) ' Get specified date in UTC
MsgBox dDateTime ' Prints "11/01/2003 16:32:37" (if locale settings are in mm/dd/yyyy format)

See Also:

Message Object
Date Property

Copyright © 2002-2022, AfterLogic Corporation. All rights reserved.