HTTP Headers
Date
The HTTP Date
request and response header include the timestamp indicating when the message was created or sent.
Syntax
Date: <day-name>, <day> <month> <year> <hour>:<minute>:<second> GMT
Directives
One of Mon, Tue, Wed, Thu, Fri, Sat, or Sun (case-sensitive).
Specifies the day of the week.
2 digit day number, e.g., “04” or “23”.
Indicates the day of the month.
One of Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec (case sensitive).
Represents the month of the year.
4 digit year number, e.g., “1990” or “2016”.
Specifies the year.
2 digit hour number, e.g., “09” or “23”.
Denotes the hour of the day in 24-hour format.
2 digit minute number, e.g., “04” or “59”.
Indicates the minutes past the hour.
2 digit second number, e.g., “04” or “59”.
Indicates the seconds past the minute.
GMT
Greenwich Mean Time. HTTP dates are always expressed in GMT, never in local time.
Example
The following HTTP message is a successful 200
status, with a Date
header showing the time the message originated.
Other headers are omitted for brevity:
HTTP/1.1 200
Content-Type: text/html
Date: Tue, 29 Oct 2024 16:56:32 GMT
<html lang="en-US" …
The Date
header is a Forbidden request header, so this code cannot set the message Date
field:
fetch("https://httpbin.org/get", {
headers: {
Date: new Date().toUTCString(),
},
});
How to Modify Header using Requestly
Requestly is a handy Chrome extension that lets you modify HTTP headers, including the Date header. This can be useful for testing how your application behaves with different date values or simulating requests with altered timestamps. Steps to Modify the Date Header:
- Install and open the Requestly Chrome extension. You can find it on the Chrome Web Store.
- Create a new rule: Click on “Create Rule” and choose “Modify Headers” from the list of available rule types.
- Add a new header modification:
- Under “Action”, select “Add” or “Override”.
- In the “Header Name” field, enter Date.
- In the “Header Value” field, enter your desired date value in the correct format (e.g., Wed, 21 Oct 2015 07:28:00 GMT).
- Set the URL condition: Specify the URL or pattern where this header change should apply (e.g., https://your-api.com/*).
- Save the rule.
Modifying the Date header allows you to test how your server or application handles requests with different timestamps, which can help in troubleshooting caching issues or validating time-dependent features.
Table of Contents
- No headings found.