Using Discord Timestamps in Bots, Embeds & Webhooks
The <t:UNIX:FORMAT> markup isn't limited to messages you type by hand — the exact same syntax works from bot code, embed fields, and webhook payloads.
Same syntax, any source
Discord's client doesn't distinguish between a timestamp a person typed and one a bot generated — both are just text matching the <t:UNIX:FORMAT> pattern, and both render identically. That means anywhere your bot sends text — a reply, a scheduled announcement, an embed field, a webhook payload — you can drop in a correctly formatted timestamp and it will render live, in each reader's own timezone, with no extra work on Discord's end.
Generating the Unix seconds in code
You need the target moment as whole seconds since the Unix epoch. In JavaScript,Math.floor(Date.now() / 1000) gives you the current moment; for an arbitrary date, build aDate object first and divide its .getTime() (milliseconds) by 1000. In Python, int(time.time()) gives the current moment, or convert a datetime withint(dt.timestamp()). Whatever language your bot is written in, the underlying requirement is the same: whole seconds, not milliseconds — a common bug is pasting a millisecond timestamp directly, which produces a wildly wrong date. Seethe troubleshooting page for how to spot that mistake.
Testing before you wire it into code
If you're building a bot feature that posts timestamps and want to see the exact rendered output before writing the generation logic, use the generator embedded on this page (or thehomepage tool) to produce a real code for your target date, paste it into a test channel, and confirm it renders the way you expect — then replicate the same Unix-seconds calculation in your bot's code.
Timestamps inside embeds
Discord embeds have their own dedicated timestamp field (shown as a small date next to the footer), which is separate from putting <t:UNIX:FORMAT> markup inside an embed's description or a field's value. You can use either independently, or both together — the dedicated footer timestamp for "when this embed was generated," and inline timestamp markup within the body for something the embed is actually about, like an event start time.
Further reading
For the complete, community-maintained technical reference on Discord's timestamp syntax and edge cases, search for LeviSnoot's Discord Timestamp Syntax gist on GitHub — it's widely cited in the Discord developer community. See also theformat code reference on this site for a plain-language breakdown of all seven letters.