⏱️ Twitter Snowflake to Timestamp Converter

Convert Twitter IDs to Unix timestamps in milliseconds and seconds

Convert Twitter ID to Timestamp

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

How to Convert Twitter Snowflake ID to Timestamp

Twitter Snowflake IDs encode Unix timestamps in their first 41 bits. To extract the timestamp:

  1. Right-shift the Snowflake ID by 22 bits to extract the timestamp portion
  2. Add Twitter's epoch (1288834974657 milliseconds) to get Unix timestamp
  3. Divide by 1000 to convert milliseconds to seconds if needed

Conversion Formula

Formula
timestamp_ms = (snowflake_id >> 22) + 1288834974657
timestamp_sec = timestamp_ms / 1000

Where:
- snowflake_id: Twitter ID (64-bit integer)
- >> 22: Right-shift by 22 bits
- 1288834974657: Twitter epoch (Nov 4, 2010, 01:42:54 UTC)
- timestamp_ms: Unix timestamp in milliseconds
- timestamp_sec: Unix timestamp in seconds

Code Examples

JavaScript
function twitterIdToTimestamp(snowflakeId) {
  const TWITTER_EPOCH = 1288834974657n;
  const id = BigInt(snowflakeId);
  const timestampMs = Number((id >> 22n) + TWITTER_EPOCH);
  const timestampSec = Math.floor(timestampMs / 1000);
  return { timestampMs, timestampSec };
}

// Example
const result = twitterIdToTimestamp('1382350606417817604');
console.log(result.timestampMs);  // 1618414206657
console.log(result.timestampSec); // 1618414206
Python
def twitter_id_to_timestamp(snowflake_id):
    TWITTER_EPOCH = 1288834974657
    timestamp_ms = ((int(snowflake_id) >> 22) + TWITTER_EPOCH)
    timestamp_sec = timestamp_ms // 1000
    return timestamp_ms, timestamp_sec

# Example
timestamp_ms, timestamp_sec = twitter_id_to_timestamp('1382350606417817604')
print(f"Milliseconds: {timestamp_ms}")  # 1618414206657
print(f"Seconds: {timestamp_sec}")      # 1618414206

Why Use Unix Timestamps?

Common Use Cases

Database Storage

Store tweet timestamps as Unix time for efficient querying and indexing.

API Integration

Convert Twitter IDs to timestamps for time-based API filtering.

Analytics

Analyze tweet timing patterns using Unix timestamps for calculations.

🔗 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