Skip to content

Date

Description

The Date response header contains the date and time at which the message was originated. It represents the time when the server generated the response, providing clients with information about when the content was created or last modified.

This header is important for caching mechanisms, as it helps clients determine the age of a resource. It also provides context for other time-related headers like Expires and Last-Modified. In debugging and logging scenarios, the Date header can be valuable for analyzing request-response timelines and diagnosing issues.

The Date header is mandatory in HTTP/1.1 responses unless the server doesn't have a clock, which is extremely rare in practice.

Syntax

The syntax of the Date header follows this structure:

Date: <day-name>, <day> <month> <year> <hour>:<minute>:<second> GMT

The date and time are always expressed in Greenwich Mean Time (GMT), using the RFC 7231 format:

  • <day-name>: Three-letter day of the week (e.g., Mon, Tue).
  • <day>: Two-digit day of the month (01-31).
  • <month>: Three-letter month (e.g., Jan, Feb).
  • <year>: Four-digit year.
  • <hour>: Two-digit hour (00-23).
  • <minute>: Two-digit minute (00-59).
  • <second>: Two-digit second (00-59).
  • GMT: Indicates that the time is in Greenwich Mean Time.

Example Syntax

Date: Mon, 02 Jun 2025 08:30:45 GMT

This example indicates that the response was generated at 8:30:45 AM GMT on June 2, 2025.

Examples

Basic Example

A standard HTTP response with a Date header:

HTTP/1.1 200 OK
Date: Mon, 02 Jun 2025 09:00:00 GMT
Content-Type: text/html; charset=UTF-8
Content-Length: 256

<!DOCTYPE html>
<html>
<head><title>Example Page</title></head>
<body><p>This is an example page.</p></body>
</html>

Caching Example

A response with caching headers that reference the Date:

HTTP/1.1 200 OK
Date: Mon, 02 Jun 2025 09:15:30 GMT
Content-Type: image/jpeg
Content-Length: 12345
Cache-Control: max-age=86400
Expires: Tue, 03 Jun 2025 09:15:30 GMT
Last-Modified: Sun, 01 Jun 2025 12:00:00 GMT

[... JPEG data ...]

In this example, the Expires header is set to exactly 24 hours (86400 seconds) after the Date, and the Last-Modified header indicates when the resource was last changed.

API Response Example

A JSON API response with a Date header:

HTTP/1.1 200 OK
Date: Mon, 02 Jun 2025 09:30:45 GMT
Content-Type: application/json
Content-Length: 123

{
  "status": "success",
  "timestamp": "2025-06-02T09:30:45Z",
  "data": {
    "message": "Hello, World!"
  }
}

Note that in this example, the API also includes the timestamp in the response body, which matches the Date header.

Summary

The Date response header provides critical timing information for HTTP communications, indicating exactly when a response was generated by the server. This information is essential for proper caching behavior, as it establishes a reference point for age calculations and expiration times. While often overlooked in day-to-day browsing, the Date header plays a fundamental role in the HTTP protocol's time-based mechanisms and helps ensure that clients have accurate information about when content was created. In most modern servers, this header is automatically generated and included in every response.