When a Discord bot displays an embed with a footer timestamp, you expect a clean date and time string like “Posted 2 hours ago” or “January 15, 2025.” Instead, you might see a raw Unix epoch number such as 1705324800 or an ISO 8601 string like 2025-01-15T14:30:00.000Z. This problem occurs because the bot code passes an unsupported timestamp format to the embed footer field. Discord’s embed API only accepts Unix timestamps in seconds, not milliseconds or ISO strings. This article explains the root cause of the wrong timestamp format and provides step-by-step fixes for bot developers and server administrators.
Key Takeaways: Fixing Discord Bot Embed Footer Timestamps
- Unix timestamp in seconds: Discord embed footers require a Unix timestamp measured in seconds, not milliseconds or ISO 8601 strings.
- discord.js
Math.floor(Date.now() / 1000): Convert JavaScript’sDate.now()(milliseconds) to seconds by dividing by 1000 and rounding down. - Discord Developer Portal > Bot > Privileged Gateway Intents: Verify that the bot has the
MESSAGE_CONTENTintent enabled if dynamic timestamp formatting is needed.
Why Discord Bot Embed Footers Show Wrong Timestamps
Discord’s embed API strictly expects timestamps in the footer to be Unix epoch timestamps expressed in whole seconds. A Unix timestamp is the number of seconds that have elapsed since January 1, 1970 00:00:00 UTC. When a bot sends a timestamp in any other format, Discord cannot parse it correctly. The embed may display the raw number, show an incorrect date, or throw an error.
Common Incorrect Timestamp Formats
The three most frequent mistakes bot developers make are:
- Milliseconds from
Date.now(): JavaScript’sDate.now()returns milliseconds. Passing this value directly to the embed footer results in a timestamp 1000 times larger than expected. - ISO 8601 strings: Strings like
2025-01-15T14:30:00Zare not accepted by the embed footer field. Discord only processes numeric Unix timestamps. - Unix timestamps with decimals: Floating-point values such as
1705324800.123cause Discord to truncate or display the decimal portion.
How Discord Processes the Footer Timestamp
When you set the timestamp property in an embed object, Discord expects an integer representing seconds since epoch. If you provide a string, Discord attempts to parse it but often fails silently. The embed will either omit the timestamp or show the raw string. If you provide a number outside the valid range (e.g., a millisecond value), Discord may show a date far in the future or past.
Steps to Fix the Wrong Timestamp in Discord Bot Embeds
The following steps assume you have access to the bot’s source code and can modify the embed creation logic. If you are a server administrator asking a bot developer to fix the issue, share these instructions.
- Identify where the embed footer timestamp is set
Locate the code that creates the embed object. Look for a line similar tofooter: { text: 'Some text', icon_url: 'url' }orsetFooter({ text: 'Some text', icon_url: 'url' }). The timestamp is usually set separately withsetTimestamp()or thetimestampproperty. - Convert milliseconds to seconds if using
Date.now()
If the code passesDate.now()directly, replace it withMath.floor(Date.now() / 1000). This divides the millisecond value by 1000 and rounds down to a whole number of seconds. - Replace ISO 8601 strings with numeric Unix timestamps
If the timestamp is a string likenew Date().toISOString(), change it toMath.floor(new Date().getTime() / 1000). ThegetTime()method returns milliseconds, so you must divide by 1000. - Remove floating-point decimals
Ensure the timestamp value is an integer. UseMath.floor()orparseInt()to strip any decimal portion. For example:const unixSeconds = Math.floor(someFloatValue). - Test the embed in a private channel
Run the bot and send the embed to a test channel. Verify that the footer shows a human-readable date like “01/15/2025” or a relative time like “2 hours ago” depending on user settings. - Check the bot’s privileged gateway intents
If the bot uses dynamic timestamp formatting (e.g.,<t:1705324800:R>), it must have theMESSAGE_CONTENTintent enabled. Go to the Discord Developer Portal, select your bot, navigate to Bot > Privileged Gateway Intents, and enable Message Content Intent.
If Discord Still Shows the Wrong Timestamp After the Fix
Embed footer shows “Invalid Date” or a long number
This usually means the timestamp value is still not a Unix timestamp in seconds. Double-check that you are not using new Date() directly (which returns a Date object) or a string. Convert the value to a number with Number() or parseInt() before passing it to the embed.
Bot embed uses setTimestamp() but shows the wrong timezone
Discord automatically converts Unix timestamps to the user’s local timezone. If the timestamp appears off by hours, the original Unix timestamp might be in a non-UTC timezone. Ensure the timestamp is generated in UTC. Use Date.UTC() to create the timestamp, or convert a local time to UTC before dividing by 1000.
Third-party bot library adds milliseconds automatically
Some Discord bot libraries (like discord.py or JDA) automatically convert datetime objects to Unix timestamps. Check the library documentation to see if it expects milliseconds or seconds. For discord.py, use int(datetime.timestamp()) to get seconds. For JDA, use Instant.now().getEpochSecond().
Discord Bot Timestamp Formats: Unix Seconds vs Other Formats
| Item | Unix Seconds (Correct) | Incorrect Format |
|---|---|---|
| Example value | 1705324800 | 1705324800000 or “2025-01-15T14:30:00Z” |
| Source in JavaScript | Math.floor(Date.now() / 1000) |
Date.now() or new Date().toISOString() |
| Discord display | User’s local date/time or relative time | Raw number or “Invalid Date” |
| Works with dynamic formatting | Yes, with <t:1705324800:R> |
No |
The correct format is always a whole number representing seconds since Unix epoch. All other formats cause display errors. When in doubt, use Math.floor(Date.now() / 1000) in JavaScript or the equivalent in your language.
Now you can identify and fix the wrong timestamp format in Discord bot embed footers. Start by converting any millisecond or ISO 8601 values to Unix seconds using Math.floor() division. For advanced control, use Discord’s dynamic timestamp formatting with the <t:unix_seconds:style> syntax to show relative time, short date, or long date. Always test the embed in a private channel before deploying the fix to production.