PeterO.Mail.MailDateTime

## PeterO.Mail.MailDateTime

public static class MailDateTime

Contains methods for parsing and generating date-time strings following the Internet Message Format (RFC 5322).

Member Summary

### GenerateDateString

public static string GenerateDateString(
    int[] dateTime);

Generates a date-time string following the Internet Message Format (RFC 5322) from an 8-element array.

Parameters:

Return Value:

A date-time string.

Exceptions:

### GenerateDateString

public static string GenerateDateString(
    int[] dateTime,
    bool gmt);

Generates a date-time string following the Internet Message Format (RFC 5322) from an 8-element array.

Parameters:

Return Value:

A date-time string.

Exceptions:

### ParseDateString

public static int[] ParseDateString(
    string str);

Gets the date and time extracted from a date-time string following the Internet Message Format (RFC 5322). Obsolete time zone strings are not allowed to appear in the date-time string. See ParseDateString(string, bool) for information on this method’s return value.

Parameters:

Return Value:

An 8-element array containing the date and time, or null if str is null, empty, or syntactically invalid, or if the string’s year would overflow the range of a 32-bit signed integer.

### ParseDateString

public static int[] ParseDateString(
    string str,
    bool parseObsoleteZones);

Gets the date and time extracted from a date-time string following the Internet Message Format (RFC 5322), with an option to allow obsolete time zone strings to appear in the date-time string. If an array is returned, the elements of that array (starting from 0) are as follows:

If a method or property uses an array of this format and refers to this method’s documentation, that array may have any number of elements 8 or greater.

Parameters:

Return Value:

An 8-element array containing the date and time, or null if str is null, empty, or syntactically invalid, or if the string’s year would overflow the range of a 32-bit signed integer.

### ParseDateStringHttp

public static int[] ParseDateStringHttp(
    string v);

Parses a date string in one of the three formats allowed by HTTP/1.1 (RFC 7231).

Parameters:

Return Value:

An array of 8 elements as specified in the ParseDateString(string, bool) method.

Back to MailLib start page.