RFC 2822 to Unix Timestamp Converter

When parsing email Date headers or older HTTP responses, you'll encounter RFC 2822 strings like `Thu, 31 Jan 2024 12:00:00 +0000`. Convert them to Unix seconds for storage or comparison.

Example: Thu, 31 Jan 2024 12:00:00 +0000

Input (RFC 2822)Thu, 31 Jan 2024 12:00:00 +0000
Unix (seconds)1706702400
Unix (milliseconds)1706702400000
ISO 8601 (UTC)2024-01-31T12:00:00Z

Common Pitfall

Note: Be liberal in what you accept: real-world email headers contain whitespace variations, missing day names, obsolete timezone abbreviations (`PST`, `EST`), and even non-RFC dates. Use a tolerant parser like Python's `email.utils.parsedate_to_datetime` rather than a strict regex.

Code Examples

Python

from email.utils import parsedate_to_datetime
int(parsedate_to_datetime('Thu, 31 Jan 2024 12:00:00 +0000').timestamp())

JavaScript

Math.floor(Date.parse('Thu, 31 Jan 2024 12:00:00 +0000') / 1000)

PHP

strtotime('Thu, 31 Jan 2024 12:00:00 +0000');

Go

t, _ := time.Parse(time.RFC1123Z, "Thu, 31 Jan 2024 12:00:00 +0000")
t.Unix()

Related Conversions

Need the full converter? Open the Timestamp Converter →