Skip to content

Instantly share code, notes, and snippets.

@LeviSnoot
Last active May 14, 2024 10:42
Show Gist options
  • Save LeviSnoot/d9147767abeef2f770e9ddcd91eb85aa to your computer and use it in GitHub Desktop.
Save LeviSnoot/d9147767abeef2f770e9ddcd91eb85aa to your computer and use it in GitHub Desktop.
Discord Timestamp Syntax

Discord Timestamps

Discord timestamps can be useful for specifying a date/time across multiple users time zones. They work with the Unix Timestamp format and can be posted by regular users as well as bots and applications.

The Epoch Unix Time Stamp Converter is a good way to quickly generate a timestamp. For the examples below I will be using the Time Stamp of 1543392060, which represents November 28th, 2018 at 09:01:00 hours for my local time zone (GMT+0100 Central European Standard Time).

Formatting

Style Input Output (12-hour clock) Output (24-hour clock)
Default <t:1543392060> November 28, 2018 9:01 AM 28 November 2018 09:01
Short Time <t:1543392060:t> 9:01 AM 09:01
Long Time <t:1543392060:T> 9:01:00 AM 09:01:00
Short Date <t:1543392060:d> 11/28/2018 28/11/2018
Long Date <t:1543392060:D> November 28, 2018 28 November 2018
Short Date/Time <t:1543392060:f> November 28, 2018 9:01 AM 28 November 2018 09:01
Long Date/Time <t:1543392060:F> Wednesday, November 28, 2018 9:01 AM Wednesday, 28 November 2018 09:01
Relative Time <t:1543392060:R> 3 years ago 3 years ago

Whether your output is 12-hour or 24-hour depends on your Discord language setting. For example, if you have your Discord language set to English, US 🇺🇸, you will get a 12-hour output. If your Discord language is set to English, UK 🇬🇧, you will get a 24-hour output.

Sources:

Discord Developer Portal

Dan's Tools

READ BEFORE COMMENTING

I realize this has become the first search result on google when you search "Discord Timestamps" so I understand all kinds of users coming here with questions.

However, I am just a newbie dev and not affiliated with Discord in any way. I suggest asking your question in the Official Discord Developer Server if you're a developer or looking over the Discord documentation.

If you're a regular Discord user looking to generate a timestamp, sesh.fyi has a purpose-built tool for that which is probably exactly what you're looking for.

@Spidey975
Copy link

ouo

@the-one-with-raspberry
Copy link

cool

@DerKampfhund
Copy link

This is the greatest day of my life

@childprof
Copy link

this is incredible!
p.s. nice profile picture bro

@bakatarexd
Copy link

I'm having trouble creating timestamp based on Discord ID's, can someone help me?

@bakatarexd
Copy link

I'm having trouble creating timestamps based on Discord ID's, can someone help me?

In addition, I converted the example Discord ID from Discord Dev Portal, and it seems to be different when converting it to Binary just using the binary converter provided by Google Search.

@G202
Copy link

G202 commented Jun 8, 2022

Do you know of a way you can dynamically reverence time. Ie. In my time zone, it is currently xx:xx, so that this dynamically displays to users in their local time?

@LeviSnoot
Copy link
Author

@G202

Do you know of a way you can dynamically reverence time. Ie. In my time zone, it is currently xx:xx, so that this dynamically displays to users in their local time?

Discord handles this on their end. Whichever time zone it detects from a user is the time zone it displays the timestamp in. When you use The Epoch Unix Time Stamp Converter referenced above it uses your devices time zone to correct itself. The Unix timestamp uses the UTC time zone only.

As an example, let's say your time zone is EST. That's UTC -5. You post the following timestamp in discord: 1654714800

This time stamp will appear to you as 3:00 PM, on June 8th, 2022. In reality the timestamp is 7:00 PM because Epoch Unix is UTC. For me, living in Sweden, the timestamp will display in Discord as being 9:00 PM. Hope that helps!

@EnderDoom77
Copy link

I'm having trouble creating timestamps based on Discord ID's, can someone help me?

In addition, I converted the example Discord ID from Discord Dev Portal, and it seems to be different when converting it to Binary just using the binary converter provided by Google Search.

IDs and timestamps are unrelated. The number contained in timestamps is what's known as Epoch Time (i.e. The number of seconds since Jan 1, 1970 0:00). It's represented in decimal, not binary. Epoch Time Converters exist to easily convert a classic date into their Epoch Time form.

@EnderDoom77
Copy link

EnderDoom77 commented Jul 11, 2022

@G202

Do you know of a way you can dynamically reverence time. Ie. In my time zone, it is currently xx:xx, so that this dynamically displays to users in their local time?

Discord handles this on their end. Whichever time zone it detects from a user is the time zone it displays the timestamp in. When you use The Epoch Unix Time Stamp Converter referenced above it uses your devices time zone to correct itself. The Unix timestamp uses the UTC time zone only.

As an example, let's say your time zone is EST. That's UTC -5. You post the following timestamp in discord: 1654714800

This time stamp will appear to you as 3:00 PM, on June 8th, 2022. In reality the timestamp is 7:00 PM because Epoch Unix is UTC. For me, living in Sweden, the timestamp will display in Discord as being 9:00 PM. Hope that helps!

Slight correction since this might be a bit confusing. You gave the example of EST (UTC-5) but then said the difference would be 7:00-3:00 = 4h. Since you said it'd be 9 PM in Sweden, I assume you're using Daylight Savings, in which case you'd be using EDT (UTC-4), with that, the math works. Hope that helped!

@ratava
Copy link

ratava commented Aug 31, 2022

I have created a discord Bot called Time Translate which provides the time code for a specified date/time.
https://github.com/ratava/TimeTraslate
Feel free to add this to your servers.

@343GuiltySpark-04
Copy link

magic

not magic my friend UNIX!

@Agnt14
Copy link

Agnt14 commented Dec 17, 2022

But what if the time is from a different timezone than I do? Like, UTC+8, how do I convert it to Discord's code and make it in a way that still in the time of the original timezone? (I choose UTC since it's a timezone system that's outlandish to me)

@danya02
Copy link

danya02 commented Dec 27, 2022

@Agnt14 the Unix timestamp is timezone-independent: conceptually it's a counter that started on Jan 1 1970 at 00:00:00 UTC, and increases by one every second (the reality of how this is computed is a bit more complex). This is why Unix timestamps are used for purposes such as these: you can give one to a system with a different timezone, and you both will know that it refers to the same moment in time.

@LeviSnoot
Copy link
Author

I realize this has become the first search result on google when you search "Discord Timestamps" so I understand all kinds of users coming here with questions.

However, I am just a newbie dev and not affiliated with Discord in any way. I suggest asking your question in the Official Discord Developer Server if you're a developer or looking over the Discord documentation.

If you're a regular Discord user looking to generate a timestamp, sesh.fyi has a purpose-built tool for that which is probably exactly what you're looking for. I will update the gist with this information as well. I appreciate the comments and questions, but I don't think I'm the right person to answer them.

@maciejkamo20
Copy link

r.3v.fi also has a good timestamp creator if someone is looking for that

@code913
Copy link

code913 commented Apr 27, 2023

nice

@Henonicks
Copy link

How to get the time from a timestamp though? Is there a formula?

@solumath
Copy link

solumath commented May 26, 2023

How to get the time from a timestamp though? Is there a formula?

@Henonicks you can copy the content of message with right click or with bot

@Henonicks
Copy link

How to get the time from a timestamp though? Is there a formula?

@Henonicks you can copy the content of message with right click or with bot

I need my bot to do so but I don't know how to make this

@wufflewaffle
Copy link

How to get the time from a timestamp though? Is there a formula?

@Henonicks you can copy the content of message with right click or with bot

I need my bot to do so but I don't know how to make this

https://www.epochconverter.com/

@wufflewaffle
Copy link

wufflewaffle commented May 28, 2023

Diablo 4 early access <t:1685660400:R>!!!
Diablo 4 early access in 4 days!!!
It won't let me use the tag in here since it isn't discord, but that is what it would look like if it were 5/28/2023 (today) and Diablo 4 early access was in 4 days which would be the "1685660400" part. and the tag <t: EPOCHTIMEHERE :R> where t= time and R= relative. You would get your epoch time in your local time and not GMT so that you don't have to convert it.

@sharkk2
Copy link

sharkk2 commented Aug 4, 2023

noice

@soleroks
Copy link

soleroks commented Oct 8, 2023

Very useful for developers. Thanks.

@alexpvpmindustry
Copy link

wow! perfect gist for our servers! thanks for the contribution!

@vcarl
Copy link

vcarl commented Oct 23, 2023

I wrote a tool to make it a little easier to create these timestamps 😁
https://www.discordtimestamps.com/
And repo: http://github.com/vcarl/discord-timestamps (Next.js/Vercel, next was def overkill but hey easy project setup/hosting)

@MetaBlue2000
Copy link

Nice ! Thx for your help !

@hadeshe93
Copy link

hadeshe93 commented Mar 27, 2024

Nice! Also found https://discordtimestampsgenerator.com/ for convenience.

@webceoboy
Copy link

webceoboy commented Mar 30, 2024

@Buggem
Copy link

Buggem commented Apr 23, 2024

JavaScript code that works to generate a discord timestamp (snippet)

console.log(`Last edited: <t:${new Date().getTime().toString().slice(0,-3)}:R>`)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment