Unix Timestamp Cheat Sheet

A quick reference for Unix timestamps. Bookmark this page. You'll need it at 2 AM when you're staring at a 13-digit number in a log file.

Convert timestamps interactively with the Epoch Converter.

Common Timestamp Values

Timestamps you'll encounter in the wild. Useful for sanity checks and test data.

EventTimestamp (seconds)Human Readable (UTC)
Unix Epoch0January 1, 1970 00:00:00
First Moon Landing-14182940July 20, 1969 20:17:40
Y2K946684800January 1, 2000 00:00:00
1 Billion Seconds1000000000September 9, 2001 01:46:40
iPhone Launch1183248000July 1, 2007 00:00:00
2020 Start1577836800January 1, 2020 00:00:00
2025 Start1735689600January 1, 2025 00:00:00
2026 Start1767225600January 1, 2026 00:00:00
Y2038 Overflow2147483647January 19, 2038 03:14:07
2050 Start2524608000January 1, 2050 00:00:00

Year Boundaries (Start of Year, UTC)

YearTimestamp
20201577836800
20211609459200
20221640995200
20231672531200
20241704067200
20251735689600
20261767225600
20271798761600
20281830297600
20291861920000
20301893456000

Format Comparison

The same moment in time expressed in different formats.

Reference moment: November 14, 2023, 22:13:20 UTC

FormatValue
Unix (seconds)1700000000
Unix (milliseconds)1700000000000
Unix (microseconds)1700000000000000
Unix (nanoseconds)1700000000000000000
ISO 86012023-11-14T22:13:20Z
ISO 8601 with offset2023-11-14T22:13:20+00:00
RFC 2822Tue, 14 Nov 2023 22:13:20 +0000
RFC 33392023-11-14T22:13:20Z
HTTP DateTue, 14 Nov 2023 22:13:20 GMT
SQL (UTC)2023-11-14 22:13:20

Convert between formats with the Date Formatter.

Unit Conversion Table

FromTo SecondsTo MillisecondsTo MicrosecondsTo Nanoseconds
1 second11,0001,000,0001,000,000,000
1 millisecond0.00111,0001,000,000
1 microsecond0.0000010.00111,000
1 nanosecond0.0000000010.0000010.0011

Quick Conversion Rules

How to Identify the Format

DigitsUnitExample
10Seconds1700000000
13Milliseconds1700000000000
16Microseconds1700000000000000
19Nanoseconds1700000000000000000

Quick Conversion One-Liners

Copy-paste snippets to get the current Unix timestamp.

Get Current Timestamp

LanguageCodeReturns
JavaScriptMath.floor(Date.now() / 1000)Seconds
Pythonint(time.time())Seconds
JavaInstant.now().getEpochSecond()Seconds
Gotime.Now().Unix()Seconds
RubyTime.now.to_iSeconds
PHPtime()Seconds
C#DateTimeOffset.UtcNow.ToUnixTimeSeconds()Seconds
RustSystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_secs()Seconds
SwiftInt(Date().timeIntervalSince1970)Seconds
Bashdate +%sSeconds

Timestamp to Date String

LanguageCode
JavaScriptnew Date(ts * 1000).toISOString()
Pythondatetime.fromtimestamp(ts, tz=timezone.utc).isoformat()
JavaInstant.ofEpochSecond(ts).toString()
Gotime.Unix(ts, 0).UTC().Format(time.RFC3339)
RubyTime.at(ts).utc.iso8601
PHPgmdate('c', $ts)
C#DateTimeOffset.FromUnixTimeSeconds(ts).ToString("o")
Bash (GNU)date -d @1700000000 --utc
Bash (macOS)date -r 1700000000 -u

Date String to Timestamp

LanguageCode
JavaScriptMath.floor(new Date('2025-01-01T00:00:00Z').getTime() / 1000)
Pythonint(datetime.fromisoformat('2025-01-01T00:00:00+00:00').timestamp())
JavaInstant.parse("2025-01-01T00:00:00Z").getEpochSecond()
Got, _ := time.Parse(time.RFC3339, "2025-01-01T00:00:00Z"); t.Unix()
RubyTime.parse("2025-01-01T00:00:00Z").to_i
PHPstrtotime('2025-01-01T00:00:00Z')
C#DateTimeOffset.Parse("2025-01-01T00:00:00Z").ToUnixTimeSeconds()
Bash (GNU)date -d "2025-01-01T00:00:00Z" +%s

Time Duration Reference

Useful constants for timestamp math.

DurationSecondsNotes
1 minute60
5 minutes300
15 minutes900
30 minutes1,800
1 hour3,600
6 hours21,600
12 hours43,200
1 day86,400
1 week604,800
30 days2,592,000Not exactly 1 month
365 days31,536,000Not exactly 1 year
365.25 days31,557,600Average year accounting for leap years

Warning: "1 month" and "1 year" do not have fixed second values. Months range from 28 to 31 days. Years are 365 or 366 days. For calendar arithmetic, use your language's datetime library instead of adding raw seconds.

Timezone Offset Quick Reference

Common timezone offsets from UTC. Remember: timestamps are always UTC. These offsets apply when displaying dates.

TimezoneAbbreviationUTC OffsetMajor Cities
UTCUTC+00:00London (winter), Reykjavik
Central EuropeanCET+01:00Berlin, Paris, Amsterdam
Eastern EuropeanEET+02:00Helsinki, Athens, Cairo
India StandardIST+05:30Mumbai, Delhi, Bangalore
China StandardCST+08:00Beijing, Shanghai, Singapore
Japan StandardJST+09:00Tokyo, Seoul
Australian EasternAEST+10:00Sydney, Melbourne
Eastern (US)EST/EDT-05:00 / -04:00New York, Toronto
Central (US)CST/CDT-06:00 / -05:00Chicago, Houston
Mountain (US)MST/MDT-07:00 / -06:00Denver, Phoenix
Pacific (US)PST/PDT-08:00 / -07:00Los Angeles, Seattle

Note: Offsets marked with two values change with Daylight Saving Time. Always use named timezones (e.g., America/New_York) rather than fixed offsets in your code.

Convert between timezones with the TZ Converter.

Common Mistakes Quick Check

SymptomLikely CauseFix
Date shows January 1, 1970Timestamp is 0 / null / undefinedCheck variable initialization
Date is in the year 55,000+Passed milliseconds where seconds expectedDivide by 1,000
Date is 50 years too earlyPassed seconds where milliseconds expectedMultiply by 1,000
Time is off by a few hoursTimezone conversion issueUse UTC consistently
Time is off by exactly 1 hourDST not accounted forUse named timezone, not fixed offset
Different results on different serversServers in different timezonesSet all servers to UTC

For the full deep dive, read The Complete Guide to Unix Timestamps. To convert a timestamp right now, open the Epoch Converter.