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 Unix seconds in code

You need the target moment as whole seconds since the Unix epoch (10 digits). Whatever language your bot is written in, whole seconds are required — sending milliseconds (13 digits) will break Discord's parser. Debugging a value your code already produced? Paste it into the Unix timestamp converter to see the date it represents before you ship it.

JavaScript / TypeScript (Discord.js v14)

import { Client, GatewayIntentBits, time, TimestampStyles } from 'discord.js';

// Method 1: Using template strings
const unixSeconds = Math.floor(Date.now() / 1000);
const timestampMarkup = `<t:${unixSeconds}:R>`; // e.g. "in 5 minutes"

// Method 2: Using discord.js built-in time() helper
const eventDate = new Date(Date.now() + 3600 * 1000);
const formatted = time(eventDate, TimestampStyles.RelativeTime);

await channel.send(`Event starts ${formatted}!`);

Python (discord.py / Disnake / Nextcord)

import time
from datetime import datetime, timezone
import discord
from discord.ext import commands

# Method 1: Direct Unix timestamp with f-strings
unix_now = int(time.time())
timestamp_markup = f"<t:{unix_now}:R>"

# Method 2: Using discord.utils.format_dt helper
future_dt = datetime(2026, 12, 31, 20, 0, tzinfo=timezone.utc)
formatted = discord.utils.format_dt(future_dt, style="F")

@bot.command()
async def raid(ctx):
    await ctx.send(f"Next raid begins {formatted} ({discord.utils.format_dt(future_dt, 'R')})")

Discord Webhook JSON Payload

{
  "content": "📢 Server Maintenance Notice",
  "embeds": [
    {
      "title": "Scheduled Patch Maintenance",
      "description": "Servers will be offline starting <t:1735689600:F> (<t:1735689600:R>).",
      "fields": [
        {
          "name": "Expected Return",
          "value": "<t:1735696800:t> local time",
          "inline": true
        }
      ],
      "color": 5793266
    }
  ]
}

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.

Free HTTP REST API

Building an external service, GitHub Action, or CI/CD script that needs to generate Discord timestamp markup via HTTP? Check out our keyless Developer Portal & API with OpenAPI specs and live sandbox testing.

Further reading

For a full cheat sheet of all seven format letters (t, T, d, D, f, F, R), see the Discord timestamp cheat sheet. If a generated timestamp is rendering as raw text, check why a Discord timestamp might not be working. Need the creation time of amessage.id, user.id, or any other Discord object instead of a value your own code produced? See the Discord snowflake decoder — a snowflake ID isn't a plain Unix timestamp, so it needs a different calculation.

Try it now

Pick a date & time

Format

Discord preview

you

 

Code to paste

All formats, this moment

CodeNameRenders asPaste this
tShort Time9:01 PM<t:…:t>
TLong Time9:01:00 PM<t:…:T>
dShort Date11/28/2018<t:…:d>
DLong DateNovember 28, 2018<t:…:D>
fShort Date/TimeNovember 28, 2018 9:01 PM<t:…:f>
FLong Date/TimeWednesday, November 28, 2018 9:01 PM<t:…:F>
RRelative Time3 years ago<t:…:R>

Frequently asked questions

How do I add a Unix timestamp in Discord programmatically?

Compute the current or target time as Unix seconds — in JavaScript, Math.floor(Date.now() / 1000); in Python, int(time.time()) — then format it into a string like <t:1735689600:F> and send that as your message content, embed field value, or webhook payload text. Discord's client renders it exactly the same way regardless of whether a human typed it or a bot sent it.

Is there a Discord timestamp command?

Discord itself doesn't expose a slash command that inserts a timestamp — the markup is just plain text you or your bot writes directly into message content. Some third-party bots add their own slash commands as a convenience, but the underlying syntax they produce is the same <t:UNIX:FORMAT> string this page describes.

Can I use a Discord timestamp inside an embed?

Yes. Put the <t:UNIX:FORMAT> string inside an embed's description, a field value, or the footer text, and Discord renders it the same as it would in ordinary message content. This is separate from an embed's dedicated timestamp property, which controls the small date shown next to the embed footer — the two are independent and can be used together.