Twitter's Default Epoch

1288834974657
📅 November 4, 2010
⏰ 01:42:54.657 UTC

All Twitter Snowflake IDs encode timestamps relative to this epoch

Calculate with Default Epoch

SNOWFLAKE ID
TIMESTAMP BITS (41-bit)
+ DEFAULT EPOCH
1288834974657 ms
= UNIX TIMESTAMP
📅 FINAL DATE

Last updated

What is Twitter's Snowflake Default Epoch?

Twitter's Snowflake default epoch is the starting point for all timestamp calculations in Twitter IDs. Instead of using the Unix epoch (January 1, 1970), Twitter chose November 4, 2010, 01:42:54.657 UTC as their custom epoch.

Why November 4, 2010?

Twitter selected this date because it was approximately when they began developing the Snowflake ID system. Using a custom epoch closer to the present provides several advantages:

Epoch Comparison

Unix Epoch

January 1, 1970

0 milliseconds

Used by most systems

Twitter Snowflake Default Epoch — Examples

Twitter's Snowflake epoch is November 4, 2010 at 01:42:54 UTC, represented as Unix timestamp 1288834974657 milliseconds. This is the reference point for all Twitter Snowflake ID timestamps. Here are examples showing how to use it correctly.

The Epoch Value

// Twitter's custom epoch — milliseconds since Unix epoch (Jan 1, 1970)
const TWITTER_EPOCH_MS = 1288834974657n;

// Verify: convert to a human-readable date
const epochDate = new Date(Number(TWITTER_EPOCH_MS));
console.log(epochDate.toISOString());
// Output: 2010-11-04T01:42:54.657Z
# Python verification
from datetime import datetime, timezone

TWITTER_EPOCH_MS = 1288834974657

epoch_date = datetime.fromtimestamp(TWITTER_EPOCH_MS / 1000, tz=timezone.utc)
print(epoch_date.isoformat())
# Output: 2010-11-04T01:42:54.657000+00:00

Why Twitter Uses a Custom Epoch

The 41-bit timestamp in a Snowflake ID can represent approximately 69 years of milliseconds:

// Calculate the maximum date for a 41-bit timestamp
const MAX_41_BIT = (1n << 41n) - 1n; // 2^41 - 1 milliseconds

// Starting from Unix epoch (1970)
const maxFromUnix = new Date(Number(MAX_41_BIT));
console.log("Max date from Unix epoch:", maxFromUnix.toISOString());
// ~2039 — too soon

// Starting from Twitter's epoch (2010)
const TWITTER_EPOCH_MS = 1288834974657n;
const maxFromTwitter = new Date(Number(MAX_41_BIT + TWITTER_EPOCH_MS));
console.log("Max date from Twitter epoch:", maxFromTwitter.toISOString());
// ~2079 — much better

Correct vs Incorrect Epoch Usage

// WRONG — using Unix epoch (missing the offset)
function decodeSnowflakeWrong(idStr) {
  const id = BigInt(idStr);
  const timestampMs = id >> 22n; // Missing epoch offset!
  return new Date(Number(timestampMs)).toISOString();
  // Returns a date in 2010 or earlier — incorrect
}

// CORRECT — using Twitter's epoch
function decodeSnowflakeCorrect(idStr) {
  const id = BigInt(idStr);
  const TWITTER_EPOCH = 1288834974657n;
  const timestampMs = (id >> 22n) + TWITTER_EPOCH; // Add epoch offset
  return new Date(Number(timestampMs)).toISOString();
}

const id = "1529877576591609861";
console.log("Wrong:", decodeSnowflakeWrong(id));   // ~2010 — wrong
console.log("Correct:", decodeSnowflakeCorrect(id)); // ~2022 — correct

Milliseconds vs Seconds Precision

// The epoch is in MILLISECONDS, not seconds
// Using the seconds value introduces a 657ms error

const TWITTER_EPOCH_SECONDS = 1288834974;    // WRONG — seconds precision
const TWITTER_EPOCH_MS      = 1288834974657; // CORRECT — milliseconds precision

// The difference
console.log("Error if using seconds:", 1288834974657 - (1288834974 * 1000), "ms");
// Output: Error if using seconds: 657 ms

// For most applications 657ms doesn't matter,
// but for precise timestamp comparison it does

Epoch Comparison: Twitter vs Other Platforms

// Different platforms use different Snowflake epochs
const EPOCHS = {
  twitter:  1288834974657n, // Nov 4, 2010
  discord:  1420070400000n, // Jan 1, 2015
  instagram: 1314220021721n, // Aug 25, 2011 (approximate)
};

// Always use the correct epoch for the platform
function decodeForPlatform(idStr, platform) {
  const epoch = EPOCHS[platform];
  if (!epoch) throw new Error(`Unknown platform: ${platform}`);
  
  const id = BigInt(idStr);
  const tsMs = (id >> 22n) + epoch;
  return new Date(Number(tsMs)).toISOString();
}

// Same ID decoded with different epochs gives different dates
const id = "1529877576591609861";
console.log("Twitter:", decodeForPlatform(id, "twitter"));
console.log("Discord:", decodeForPlatform(id, "discord"));

Using the Epoch for ID Range Queries

# Python — convert a date to a Snowflake ID for API queries
from datetime import datetime, timezone

TWITTER_EPOCH_MS = 1288834974657

def date_to_snowflake_id(dt):
    """
    Convert a datetime to the minimum Snowflake ID for that moment.
    Use as since_id in Twitter API queries.
    """
    ts_ms = int(dt.timestamp() * 1000) - TWITTER_EPOCH_MS
    
    if ts_ms < 0:
        raise ValueError("Date is before Twitter's Snowflake epoch (Nov 4, 2010)")
    
    return str(ts_ms << 22)

# Example: find the min ID for a specific date
target = datetime(2023, 1, 1, tzinfo=timezone.utc)
min_id = date_to_snowflake_id(target)
print(f"Min ID for {target.date()}: {min_id}")

Defining the Epoch as a Constant

// Best practice: define the epoch as a named constant
// with a comment explaining what it is

// JavaScript
const TWITTER_SNOWFLAKE_EPOCH_MS = 1288834974657n;
// Twitter's custom epoch: November 4, 2010 at 01:42:54.657 UTC
// Used as the reference point for all Twitter Snowflake ID timestamps

// Java
// private static final long TWITTER_EPOCH_MS = 1288834974657L;
// // Twitter Snowflake epoch: 2010-11-04T01:42:54.657Z

// C#
// private const long TwitterEpochMs = 1288834974657L;
// // Twitter Snowflake epoch: November 4, 2010 01:42:54.657 UTC

// Go
// const twitterEpochMs int64 = 1288834974657
// // Twitter Snowflake epoch: 2010-11-04T01:42:54.657Z

Epoch Reference Summary

  • Twitter epoch: November 4, 2010 at 01:42:54.657 UTC
  • Unix milliseconds: 1288834974657
  • Unix seconds: 1288834974 (note: millisecond precision is 657ms)
  • Maximum Snowflake date: approximately year 2079
  • Always use milliseconds (not seconds) for the epoch value
  • Always add the epoch offset when decoding — never skip it

The epoch is the single most important constant in Snowflake ID decoding. Getting it right — using the correct value in milliseconds — ensures all decoded timestamps are accurate.

Twitter Epoch

November 4, 2010

1288834974657 ms

Custom for Snowflake

Discord Epoch

January 1, 2015

1420070400000 ms

Different custom epoch

How to Use the Default Epoch

To convert a Twitter Snowflake ID to a timestamp, follow this formula:

// JavaScript Example
const TWITTER_EPOCH = 1288834974657n;
const snowflakeId = 1382350606417817604n;

// Extract timestamp bits (right-shift by 22)
const timestampBits = snowflakeId >> 22n;

// Add Twitter's default epoch
const unixTimestamp = Number(timestampBits + TWITTER_EPOCH);

// Convert to date
const date = new Date(unixTimestamp);
console.log(date); // April 18, 2021
# Python Example
TWITTER_EPOCH = 1288834974657
snowflake_id = 1382350606417817604

# Extract timestamp bits
timestamp_bits = snowflake_id >> 22

# Add Twitter's default epoch
unix_timestamp = timestamp_bits + TWITTER_EPOCH

# Convert to datetime
from datetime import datetime
date = datetime.fromtimestamp(unix_timestamp / 1000)
print(date) # 2021-04-18

Technical Details

  • Epoch value: 1288834974657 milliseconds since Unix epoch
  • Date: November 4, 2010, 01:42:54.657 UTC
  • Used in: All Twitter Snowflake IDs (tweets, users, DMs)
  • Bit position: First 41 bits of the 64-bit ID
  • Maximum lifespan: ~69 years from epoch (until ~2079)
  • Precision: Millisecond accuracy

Common Use Cases

  • Implementing Twitter ID decoders
  • Building Twitter API integrations
  • Analyzing tweet timelines
  • Debugging timestamp issues
  • Creating custom Snowflake implementations

Frequently Asked Questions

Twitter's Snowflake default epoch is November 4, 2010, 01:42:54 UTC (1288834974657 milliseconds since Unix epoch). This is the starting point for all Twitter Snowflake ID timestamps. All Twitter IDs encode time relative to this custom epoch instead of the Unix epoch (January 1, 1970).

Twitter chose November 4, 2010 as their epoch because it was approximately when they began developing the Snowflake system. Using a custom epoch closer to the present extends the lifespan of 41-bit timestamps by ~69 years from 2010 instead of 1970, allowing Twitter IDs to remain valid until approximately 2079.

To convert a Twitter Snowflake ID to a timestamp: 1) Right-shift the ID by 22 bits to extract the timestamp portion, 2) Add Twitter's epoch (1288834974657 milliseconds), 3) Convert to a date. Example: ID 1382350606417817604 >> 22 = 329933406417, + 1288834974657 = 1618768381074 = April 18, 2021.

Twitter's Snowflake epoch in milliseconds is 1288834974657. This represents November 4, 2010, 01:42:54.657 UTC. In JavaScript: new Date(1288834974657) returns this exact timestamp.