Convert Twitter Snowflake ID to Unix Timestamp

Enter Twitter/X snowflake ID to extract Unix timestamp

Unix Timestamp (milliseconds)
Unix Timestamp (seconds)
Tweet Posted On
ISO 8601 Format

Last updated

Decoding the Timestamp

// JavaScript (BigInt required)
const id = 1700000000000000000n;
const twitterEpoch = 1288834974657n;

const timestampMs = (id >> 22n) + twitterEpoch;
const date = new Date(Number(timestampMs));

console.log("Timestamp (ms):", timestampMs.toString());
console.log("Date (UTC):", date.toUTCString());
console.log("ISO 8601:", date.toISOString());
# Python
id_val = 1700000000000000000
twitter_epoch_ms = 1288834974657

timestamp_ms = (id_val >> 22) + twitter_epoch_ms
timestamp_s = timestamp_ms / 1000

from datetime import datetime, timezone
dt = datetime.fromtimestamp(timestamp_s, tz=timezone.utc)
print(f"Date: {dt.strftime('%Y-%m-%d %H:%M:%S UTC')}")
print(f"Unix timestamp: {timestamp_s}")
print(f"ISO 8601: {dt.isoformat()}")

Decoded Components

Breaking down the 64-bit ID into its Snowflake components:

// Full component extraction
const id = 1700000000000000000n;
const twitterEpoch = 1288834974657n;

const timestamp = (id >> 22n) + twitterEpoch;
const datacenterId = (id >> 17n) & 0x1Fn;
const workerId = (id >> 12n) & 0x1Fn;
const sequence = id & 0xFFFn;

console.log({
  date: new Date(Number(timestamp)).toISOString(),
  datacenterId: Number(datacenterId),
  workerId: Number(workerId),
  sequence: Number(sequence)
});

Using Round-Number IDs for API Queries

Round-number IDs are convenient anchors for Twitter API queries. Instead of querying by date (which requires extra API calls), use ID-based filtering:

# Fetch tweets after ID 1700000000000000000
import requests

headers = {"Authorization": "Bearer YOUR_BEARER_TOKEN"}

# Get tweets after this milestone ID
params = {
    "query": "#python",
    "since_id": "1700000000000000000",
    "max_results": 100,
    "tweet.fields": "created_at,author_id"
}

response = requests.get(
    "https://api.twitter.com/2/tweets/search/recent",
    headers=headers,
    params=params
)
tweets = response.json()
print(f"Found {len(tweets.get('data', []))} tweets")

ID Progression Over Time

Understanding how Twitter IDs progress helps with data analysis. The rate of ID generation reflects Twitter's activity level:

// Calculate approximate date for any round-number ID
function decodeSnowflakeDate(idStr) {
  const id = BigInt(idStr);
  const twitterEpoch = 1288834974657n;
  const timestampMs = (id >> 22n) + twitterEpoch;
  return new Date(Number(timestampMs));
}

// Reference milestones
const milestones = [
  "1000000000000000000",
  "1500000000000000000",
  "1700000000000000000",
  "1900000000000000000",
  "2000000000000000000"
];

milestones.forEach(id => {
  console.log(`ID ${id}: ${decodeSnowflakeDate(id).toDateString()}`);
});

Partitioning Data by ID Range

For large-scale Twitter data processing, ID ranges are more reliable than date ranges for partitioning datasets:

# Example: Partition a dataset by ID range
def get_id_for_date(target_date_str):
    """
    Binary search approach to find the ID closest to a target date.
    Use known milestone IDs as starting points.
    """
    from datetime import datetime, timezone
    
    milestones = {
        "1700000000000000000": decode_snowflake_date(1700000000000000000),
        "1800000000000000000": decode_snowflake_date(1800000000000000000),
        "1900000000000000000": decode_snowflake_date(1900000000000000000),
    }
    
    target = datetime.fromisoformat(target_date_str).replace(tzinfo=timezone.utc)
    
    # Find the closest milestone
    closest = min(milestones.items(), key=lambda x: abs(x[1] - target))
    return closest[0]

def decode_snowflake_date(id_val):
    from datetime import datetime, timezone
    ts_ms = (id_val >> 22) + 1288834974657
    return datetime.fromtimestamp(ts_ms / 1000, tz=timezone.utc)

Verifying the Decode

The Snowflake decode is deterministic — the same ID always produces the same timestamp. You can verify by:

Round-number IDs like 1700000000000000000 are valuable reference points for anyone working with Twitter data at scale. Knowing the corresponding date allows you to build efficient queries, partition datasets, and understand the timeline of Twitter's activity.

Code Examples

JavaScript

const tweetId = 1382350606417817604n; const twitterEpoch = 1288834974657n; const timestamp = (tweetId >> 22n) + twitterEpoch; console.log(Number(timestamp)); // 1618592259657

Python

tweet_id = 1382350606417817604 twitter_epoch = 1288834974657 timestamp = (tweet_id >> 22) + twitter_epoch print(timestamp) # 1618592259657

Common Use Cases

Frequently Asked Questions

Can I get the exact millisecond a tweet was posted?

Yes! Twitter snowflake IDs encode millisecond-precision timestamps. Our converter extracts the exact millisecond the tweet was created on Twitter's servers.

Do X (formerly Twitter) IDs use the same format?

Yes, X continues to use the same snowflake ID format with the same epoch (November 4, 2010). All tweet IDs from both Twitter and X can be converted using this tool.

Why is Twitter's epoch November 4, 2010?

Twitter launched snowflake IDs on November 4, 2010, replacing sequential IDs. This date became the epoch for all future tweet IDs.

Can I convert timestamps back to tweet IDs?

Not exactly. While you can create a snowflake ID from a timestamp, you can't recreate the original tweet ID because it also contains worker ID and sequence number.

Twitter ID 1700000000000000000 — Decoded Example

This page decodes the round-number Twitter Snowflake ID 1700000000000000000 and shows the corresponding timestamp. Round-number IDs like this are useful reference points for understanding the progression of Twitter IDs over time and for building efficient API queries.

Frequently Asked Questions

Enter the Twitter snowflake ID and click Convert. The tool extracts the embedded timestamp using the formula: (id >> 22) + 1288834974657, returning the Unix timestamp in milliseconds.

Twitter's snowflake epoch is 1288834974657 milliseconds (November 4, 2010, 01:42:54 UTC). All Twitter IDs encode timestamps relative to this epoch.