Date Formats

Dates are used as values in several HTTP headers. The proper format for a date is as follows:

Tue, 21 May 2002 12:34:56 GMT 

Consider this format in parts:

  • First three characters of the day of the week, followed by a comma and a space

  • Two-digit day of the month (01-31), followed by a space

  • First three characters of the month, followed by a space

  • Four-digit year, followed by a space

  • Two-digit hour (0-23), followed by a colon

  • Two-digit minute (0-59), followed by a colon

  • Two-digit second (0-59), followed by a space and then GMT

This format allows for a date that is universally understood (GMT), unambiguous (no confusion between month and day or which century a year refers to), and of a fixed-length for easier dissection.

Most programming ...

Get HTTP Developer’s Handbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.