Last updated
Discord User IDs and Account Age
Discord user IDs are Snowflake IDs that encode the account creation timestamp. By decoding a user ID, you can determine exactly when an account was created — useful for detecting new accounts in moderation, verifying account age requirements, and understanding user history.
Decoding User Account Creation Date
JavaScript
const DISCORD_EPOCH = 1420070400000n;
function getUserCreationDate(userId) {
const id = BigInt(userId);
const ms = Number((id >> 22n) + DISCORD_EPOCH);
const date = new Date(ms);
const now = Date.now();
const ageMs = now - ms;
const ageDays = Math.floor(ageMs / 86400000);
return {
userId,
createdAt: date.toISOString(),
createdAtLocal: date.toLocaleString(),
accountAgeDays: ageDays,
accountAgeYears: (ageDays / 365.25).toFixed(1)
};
}
// Example
const info = getUserCreationDate('175928847299117063');
console.log(`Account created: ${info.createdAt}`);
console.log(`Account age: ${info.accountAgeDays} days`);
Account Age in Discord Bots
JavaScript
// Discord.js: check account age on join
client.on('guildMemberAdd', async (member) => {
const createdAt = member.user.createdAt;
const ageDays = (Date.now() - createdAt.getTime()) / 86400000;
if (ageDays < 7) {
// Account less than 7 days old — flag for review
const logChannel = member.guild.channels.cache.find(c => c.name === 'mod-log');
logChannel?.send(`New member ${member.user.tag} has a ${ageDays.toFixed(1)}-day-old account.`);
}
});