Class that represents an RFC 2822 date-time.
For a list of all members of this type, see DateTime Members.
System.Object
Node
FieldBody
DateTime
DateTime represents an Internet date-time
string as described in RFC 2822.
The parse operation for DateTime parses the string
representation to extract the year, month, day, hour, minute, second,
and time zone. DateTime provides methods to set or get the
individual elements of the date-time.
The use of DateTime is best explained by considering
the following use cases.
DateTime parses Internet date-time strings. When a
MIME message is received, perhaps from a remote source, you may set the
inherited String property, or use the DateTime constructor, to set the string
representation of the DateTime object. Then call the Parse() method to parse the string
representation. Finally, retrieve the properties Year, Month, and so on, to access the
parsed elements of the date-time string.
DateTime generates Internet date-time strings. Use
the default constructor to create a new DateTime object with a
null date-time. Call one of the methods SetValuesLocal() or SetValuesLiteral() to set the year, month, day, hour,
minute, second, and zone with the desired values. Alternatively, you
can set the values for the date-time from a Posix scalar time, using
the FromPosixTime() method. Then call the Assemble() method to create the string representation.
Finally, retrieve the inherited String
property to get the string representation.
DateTime converts to and from a scalar date and
time. Call the FromPosixTime() method or
the AsPosixTime() method to convert from or to a
"Posix time," defined as the number of seconds elapsed since
1 Jan 1970 00:00:00 UTC. By converting to a scalar
representation of the date and time, Hunny MIME.NET makes it easy for
you to compare two different dates.
Note: It is possible that DateTime will encounter an error
while parsing a date-time string. When this happens, throwing an
exception is not a wise way to proceed, since in most cases higher
level operations would also have to terminate before the library user's
code could deal with the exception. What actually happens, is that
DateTime "recovers" from the error by setting the date and time
to 1 Jan 1970 00:00:00 UTC. To easily check whether a parse
operation completed successfully, you can call AsPosixTime() and examine the return value. A value of
zero indicates that the parsing operation failed; any other value
indicates it succeeded.
Namespace: Hunny.Mime
Assembly: Hunny.Mime (in Hunny.Mime.dll)
DateTime Members | Hunny.Mime Namespace