Last updated
Twitter ID to Date Converter — Examples
The Twitter ID to Date Converter extracts the precise creation timestamp from any Twitter Snowflake ID. Every Twitter ID encodes the exact millisecond it was created in its first 41 bits. Here are practical examples of how to use this conversion.
User Account Creation Date
Twitter user IDs use the same Snowflake format. You can find when any account was created from its user ID:
// Get account creation date from user ID
function getAccountCreationDate(userIdStr) {
return twitterIdToDate(userIdStr);
}
// Example: Elon Musk's Twitter user ID is 44196397
// (This is a small pre-Snowflake ID, so it won't decode correctly)
// For Snowflake-era accounts (after Nov 2010):
const userId = "783214"; // @Twitter's user ID
const created = getAccountCreationDate(userId);
console.log("Account created:", created.toDateString());
Bulk Conversion
# Python — convert a list of tweet IDs to dates
from datetime import datetime, timezone
def twitter_id_to_date(id_val):
twitter_epoch_ms = 1288834974657
timestamp_ms = (id_val >> 22) + twitter_epoch_ms
return datetime.fromtimestamp(timestamp_ms / 1000, tz=timezone.utc)
tweet_ids = [
"1529877576591609861",
"1700000000000000000",
"1800000000000000000",
"1900000000000000000",
]
print(f"{'Tweet ID':<25} {'Date (UTC)'}")
print("-" * 55)
for id_str in tweet_ids:
dt = twitter_id_to_date(int(id_str))
print(f"{id_str:<25} {dt.strftime('%Y-%m-%d %H:%M:%S')}")
Date to ID Conversion (for API Queries)
Convert a date to the minimum Snowflake ID for that moment — useful for Twitter API pagination:
// JavaScript — get the minimum Snowflake ID for a given date
function dateToSnowflakeId(date) {
const twitterEpoch = 1288834974657n;
const timestampMs = BigInt(date.getTime()) - twitterEpoch;
// Shift left 22 bits, sequence/worker/datacenter bits are 0 (minimum ID)
return (timestampMs << 22n).toString();
}
// Example: find the minimum ID for January 1, 2023
const targetDate = new Date("2023-01-01T00:00:00Z");
const minId = dateToSnowflakeId(targetDate);
console.log("Min ID for 2023-01-01:", minId);
// Use in Twitter API query
const apiUrl = `https://api.twitter.com/2/tweets/search/recent?since_id=${minId}`;
Verifying Tweet Timestamps
Journalists and fact-checkers use ID-to-date conversion to verify when tweets were posted, independent of potentially manipulated screenshots:
# Extract tweet ID from a Twitter URL and decode it
import re
from datetime import datetime, timezone
def extract_tweet_id_from_url(url):
"""Extract tweet ID from a Twitter/X URL."""
match = re.search(r'/status/(\d+)', url)
return match.group(1) if match else None
def verify_tweet_date(tweet_url):
tweet_id = extract_tweet_id_from_url(tweet_url)
if not tweet_id:
return "Could not extract tweet ID from URL"
id_val = int(tweet_id)
twitter_epoch_ms = 1288834974657
timestamp_ms = (id_val >> 22) + twitter_epoch_ms
dt = datetime.fromtimestamp(timestamp_ms / 1000, tz=timezone.utc)
return {
"tweet_id": tweet_id,
"created_at_utc": dt.isoformat(),
"unix_timestamp": dt.timestamp()
}
# Example
url = "https://twitter.com/user/status/1529877576591609861"
result = verify_tweet_date(url)
print(result)
Handling Pre-Snowflake IDs
Twitter switched to Snowflake IDs in November 2010. Older IDs (before the switch) cannot be decoded with the Snowflake algorithm:
- Pre-Snowflake IDs: small numbers (typically under ~27 billion)
- Snowflake IDs: large numbers starting around 27 billion after Nov 2010
- The transition happened around November 4, 2010
- Pre-Snowflake IDs do not encode timestamps and cannot be decoded this way
function isSnowflakeId(idStr) {
// Snowflake IDs are larger than ~27 billion
// Pre-Snowflake IDs are smaller
const SNOWFLAKE_THRESHOLD = 27000000000n;
return BigInt(idStr) > SNOWFLAKE_THRESHOLD;
}
console.log(isSnowflakeId("783214")); // false — pre-Snowflake
console.log(isSnowflakeId("1529877576591609861")); // true — Snowflake
Output Formats
The converter displays timestamps in multiple formats for maximum compatibility:
- UTC datetime: 2022-05-26 14:30:00 UTC
- ISO 8601: 2022-05-26T14:30:00.000Z
- Unix timestamp (seconds): 1653572200
- Unix timestamp (milliseconds): 1653572200000
- Local time: adjusted to the user's browser timezone
The ISO 8601 format is recommended for programmatic use and data storage. Unix timestamps are best for calculations and database storage. Human-readable formats are best for display in user interfaces.
Fact Checking
Verify exactly when tweets were posted for journalism, investigations, and fact-checking.
Content Strategy
Study when successful tweets were posted to optimize your posting schedule.
Legal Evidence
Provide precise timestamps for legal matters, disputes, or documentation.
Bot Detection
Identify suspicious posting patterns by analyzing tweet timestamps.
Archive Management
Organize and sort saved tweets by their actual creation time.