⏱️ Twitter Snowflake ID to Timestamp

Extract Unix timestamps from Twitter IDs with millisecond precision

Convert Twitter ID to Unix Timestamp

📌 Try these examples:
TWITTER SNOWFLAKE ID
⏱️ UNIX TIMESTAMP (milliseconds)
⏱️ UNIX TIMESTAMP (seconds)
📅 HUMAN-READABLE DATE
🕐 ISO 8601 FORMAT

How Twitter Snowflake ID to Timestamp Conversion Works

Twitter Snowflake IDs are 64-bit integers where the first 41 bits encode the timestamp. To extract the Unix timestamp:

Extraction Formula:

timestamp_ms = (snowflake_id >> 22) + 1288834974657

Steps:

  1. Right-shift the Snowflake ID by 22 bits to extract timestamp bits
  2. Add Twitter's epoch: 1288834974657 (Nov 4, 2010, 01:42:54 UTC)
  3. Result is Unix timestamp in milliseconds
  4. Divide by 1000 for Unix timestamp in seconds

Why Extract Timestamps from Twitter IDs?

📊

Time-Series Analysis

Use timestamps for chronological sorting and timeline analysis of tweets.

🤖

API Integration

Convert Twitter IDs to timestamps for database storage and API responses.

🔍

Forensic Analysis

Verify exact tweet posting times for investigations and fact-checking.

Code Examples: Extract Timestamp from Twitter ID

JavaScript
// JavaScript - Extract Unix timestamp from Twitter Snowflake ID
function extractTimestamp(snowflakeId) {
  const TWITTER_EPOCH = 1288834974657n;
  const id = BigInt(snowflakeId);
  const timestampMs = Number((id >> 22n) + TWITTER_EPOCH);
  const timestampSec = Math.floor(timestampMs / 1000);
  
  return {
    milliseconds: timestampMs,
    seconds: timestampSec,
    date: new Date(timestampMs)
  };
}

// Example
const result = extractTimestamp('1382350606417817604');
console.log(result.milliseconds); // 1618414206657
console.log(result.seconds);      // 1618414206
console.log(result.date.toISOString()); // 2021-04-14T15:30:06.657Z
Python
# Python - Extract Unix timestamp from Twitter Snowflake ID
from datetime import datetime

def extract_timestamp(snowflake_id):
    TWITTER_EPOCH = 1288834974657
    timestamp_ms = ((int(snowflake_id) >> 22) + TWITTER_EPOCH)
    timestamp_sec = timestamp_ms // 1000
    
    return {
        'milliseconds': timestamp_ms,
        'seconds': timestamp_sec,
        'date': datetime.fromtimestamp(timestamp_sec)
    }

# Example
result = extract_timestamp('1382350606417817604')
print(result['milliseconds'])  # 1618414206657
print(result['seconds'])       # 1618414206
print(result['date'].isoformat())  # 2021-04-14T15:30:06

Understanding Twitter's Epoch

Twitter uses a custom epoch of November 4, 2010, 01:42:54 UTC (1288834974657 milliseconds since Unix epoch). This custom epoch:

Timestamp Precision

Millisecond Precision: Twitter Snowflake IDs store timestamps with millisecond precision, making them accurate to 1/1000th of a second.

Why it matters: This precision allows for:

  • Exact chronological ordering of tweets posted in the same second
  • High-frequency event tracking and analysis
  • Precise time-series data for analytics

Frequently Asked Questions

Q: What's the difference between milliseconds and seconds timestamp?

A: Milliseconds timestamp includes 3 extra digits for sub-second precision. Divide by 1000 to convert to seconds. Twitter stores milliseconds for higher accuracy.

Q: Can I extract timestamps from deleted tweets?

A: Yes! The timestamp is encoded in the ID itself, so even if a tweet is deleted, you can still extract when it was originally posted.

Q: Are Twitter user IDs also Snowflake IDs?

A: Yes, Twitter user IDs use the same Snowflake format. Extract the timestamp to see when an account was created.

🔗 Related Snowflake ID Tools

🐦 Twitter Snowflake Decoder 💬 Discord Snowflake Decoder 📸 Instagram Snowflake Decoder

📚 Learn More About Snowflake IDs

How to Decode Tutorial Real ID Examples Snowflake Calculator ID to Timestamp