HttpResponseHeaderCollection.Date Propiedad

Definición

Obtiene o establece el objeto DateTime que representa el valor de un encabezado HTTP date en una respuesta HTTP.

public:
 property IReference<DateTime> ^ Date { IReference<DateTime> ^ get(); void set(IReference<DateTime> ^ value); };
IReference<DateTime> Date();

void Date(IReference<DateTime> value);
public System.Nullable<System.DateTimeOffset> Date { get; set; }
var iReference = httpResponseHeaderCollection.date;
httpResponseHeaderCollection.date = iReference;
Public Property Date As Nullable(Of DateTimeOffset)

Valor de propiedad

Objeto que representa el valor de un encabezado HTTP de fecha en una solicitud HTTP. Un valor NULL significa que el encabezado no está presente.

Comentarios

La propiedad Date representa el valor de un encabezado HTTP date en una respuesta HTTP. El encabezado Date es la fecha y hora en que se envió el mensaje.

Los lenguajes Javascript y .NET no usan el objeto DateTime directamente. En Javascript, datetime se proyecta como un objeto y en .NET se proyecta como System.DateTimeOffset. Cada idioma controla de forma transparente la conversión a los intervalos de granularidad y fecha del idioma correspondiente.

En C++, un valor tiene la misma granularidad que y admite los intervalos de fechas requeridos por Javascript y .NET.

Para obtener información más detallada, vea la estructura Windows.Foundation.DateTime .

El código de ejemplo siguiente muestra un método para obtener y establecer el encabezado Date en un objeto HttpResponseMessage mediante la propiedad Date en el objeto HttpResponseHeaderCollection .

public void DemonstrateHeaderResponseDate() {
    var response = new HttpResponseMessage();

    // Set the header with a strong type.
    response.Headers.Date = DateTimeOffset.UtcNow;

    // Get the strong type out
    System.Diagnostics.Debug.WriteLine("Date value in ticks: {0}", response.Headers.Date.Value.Ticks);

    // The ToString() is useful for diagnostics, too.
    System.Diagnostics.Debug.WriteLine("The Date ToString() results: {0}", response.Headers.Date.ToString());
}

Se aplica a

Consulte también