Class Rfc822DateTimeUtil
Provides methods for converting System.DateTime structures to and from the equivalent RFC 822 string representation.
Inheritance
Inherited Members
Namespace: ImageVault.Core.Lib.Net.Http
Assembly: ImageVault.Core.dll
Syntax
public static class Rfc822DateTimeUtil
Remarks
Properties
Rfc822DateTimeFormat
Gets the custom format specifier that may be used to represent a System.DateTime in the RFC 822 format.
Declaration
public static string Rfc822DateTimeFormat { get; }
Property Value
Type | Description |
---|---|
System.String | A DateTime format string that may be used to represent a System.DateTime in the RFC 822 format. |
Remarks
This method returns a string representation of a System.DateTime that utilizes the time zone offset (local differential) to represent the offset from Greenwich mean time in hours and minutes. The Rfc822DateTimeFormat is a valid date-time format string for use in the System.DateTime.ToString(System.String,System.IFormatProvider) method.
The RFC 822 Date and Time specification specifies that the year will be represented as a two-digit value, but the RSS Profile recommends that all date-time values should use a four-digit year. The Rfc822DateTimeUtil class follows the RSS Profile recommendation when converting a System.DateTime to the equivalent RFC 822 string representation.
Rfc822DateTimePatterns
Gets an array of the expected formats for RFC 822 date-time string representations.
Declaration
public static string[] Rfc822DateTimePatterns { get; }
Property Value
Type | Description |
---|---|
System.String[] | An array of the expected formats for RFC 822 date-time string representations that may used in the System.DateTime.TryParseExact(System.String,System.String[],System.IFormatProvider,System.Globalization.DateTimeStyles,System.DateTime@) method. |
Remarks
The array of the expected formats that is returned assumes that the RFC 822 time zone is represented as or converted to a local differential representation.
Methods
ConvertZoneToLocalDifferential(String)
Converts the time zone component of an RFC 822 date and time string representation to its local differential (time zone offset).
Declaration
public static string ConvertZoneToLocalDifferential(string s)
Parameters
Type | Name | Description |
---|---|---|
System.String | s | A string containing an RFC 822 date and time to convert. |
Returns
Type | Description |
---|---|
System.String | A date and time string that uses local differential to describe the time zone equivalent to the date and time contained in |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
System.ArgumentNullException |
|
Parse(String)
Converts the specified string representation of a date and time to its System.DateTime equivalent.
Declaration
public static DateTime Parse(string s)
Parameters
Type | Name | Description |
---|---|---|
System.String | s | A string containing a date and time to convert. |
Returns
Type | Description |
---|---|
System.DateTime | A System.DateTime equivalent to the date and time contained in |
Remarks
The string s
is parsed using formatting information in the System.Globalization.DateTimeFormatInfo.InvariantInfo object.
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
System.FormatException |
|
System.ArgumentNullException |
|
ToString(DateTime)
Converts the value of the specified System.DateTime object to its equivalent string representation.
Declaration
public static string ToString(DateTime utcDateTime)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | utcDateTime | The Coordinated Universal Time (UTC) System.DateTime to convert. |
Returns
Type | Description |
---|---|
System.String | A RFC 822 string representation of the value of the |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | The specified |
TryParse(String, out DateTime)
Converts the specified string representation of a date and time to its System.DateTime equivalent.
Declaration
public static bool TryParse(string s, out DateTime result)
Parameters
Type | Name | Description |
---|---|---|
System.String | s | A string containing a date and time to convert. |
System.DateTime | result | When this method returns, contains the System.DateTime value equivalent to the date and time
contained in |
Returns
Type | Description |
---|---|
System.Boolean | true if the |
Remarks
The string s
is parsed using formatting information in the System.Globalization.DateTimeFormatInfo.InvariantInfo object.