<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Quratulain Memon</title>
    <description>The latest articles on DEV Community by Quratulain Memon (@quratulain_memon_31b25f7e).</description>
    <link>https://dev.to/quratulain_memon_31b25f7e</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4029054%2Fd8ec7f45-c0e7-46d5-bf6b-6f93c966dd9e.png</url>
      <title>DEV Community: Quratulain Memon</title>
      <link>https://dev.to/quratulain_memon_31b25f7e</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/quratulain_memon_31b25f7e"/>
    <language>en</language>
    <item>
      <title>"How Discord Timestamps Work — A Complete Guide"</title>
      <dc:creator>Quratulain Memon</dc:creator>
      <pubDate>Tue, 14 Jul 2026 17:05:19 +0000</pubDate>
      <link>https://dev.to/quratulain_memon_31b25f7e/how-discord-timestamps-work-a-complete-guide-dph</link>
      <guid>https://dev.to/quratulain_memon_31b25f7e/how-discord-timestamps-work-a-complete-guide-dph</guid>
      <description>&lt;h2&gt;
  
  
  How Discord Timestamps Work — A Complete Guide
&lt;/h2&gt;

&lt;p&gt;If you've ever seen a message in Discord that says "3 hours ago" or "Tomorrow at 9:00 AM" and wondered how it stays accurate no matter who's reading it, the answer is a small piece of Markdown syntax that Discord added a few years ago: dynamic timestamps.&lt;/p&gt;

&lt;p&gt;This post breaks down exactly how they work, why they're better than typing a date manually, and how to generate them without doing the math yourself.&lt;/p&gt;

&lt;h3&gt;
  
  
  The syntax
&lt;/h3&gt;

&lt;p&gt;Discord renders a timestamp whenever it sees this pattern in a message:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;t:1721000000:R&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two parts matter here:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;1721000000&lt;/code&gt; — a Unix timestamp (seconds since Jan 1, 1970 UTC)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;R&lt;/code&gt; — a format flag that controls how it's displayed&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Discord's client reads the Unix timestamp, converts it to &lt;em&gt;the viewer's own local timezone&lt;/em&gt;, and renders it using the style you picked. That's the whole trick — the message itself never changes, but everyone sees a time that's correct for them.&lt;/p&gt;

&lt;h3&gt;
  
  
  The 7 format flags
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Flag&lt;/th&gt;
&lt;th&gt;Style&lt;/th&gt;
&lt;th&gt;Example&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;t&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Short time&lt;/td&gt;
&lt;td&gt;4:20 PM&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;T&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Long time&lt;/td&gt;
&lt;td&gt;4:20:30 PM&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;d&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Short date&lt;/td&gt;
&lt;td&gt;07/14/2026&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;D&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Long date&lt;/td&gt;
&lt;td&gt;July 14, 2026&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;f&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Short date/time&lt;/td&gt;
&lt;td&gt;July 14, 2026 4:20 PM&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;F&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Long date/time&lt;/td&gt;
&lt;td&gt;Monday, July 14, 2026 4:20 PM&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;R&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Relative&lt;/td&gt;
&lt;td&gt;3 hours ago / in 2 days&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;code&gt;R&lt;/code&gt; is by far the most commonly used, especially for event countdowns, since it automatically updates itself as time passes — no editing required.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why not just type the date?
&lt;/h3&gt;

&lt;p&gt;Two problems with hardcoding a date/time in a message:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Timezones.&lt;/strong&gt; "9 PM EST" means nothing useful to someone in Karachi or Tokyo without them doing the conversion in their head.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Drift.&lt;/strong&gt; A relative time like "in 3 hours" written as plain text is wrong the moment someone reads it an hour later. Discord's &lt;code&gt;R&lt;/code&gt; flag recalculates it live, client-side, every time it's viewed.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Dynamic timestamps solve both, for free, using a format the client already understands.&lt;/p&gt;

&lt;h3&gt;
  
  
  Getting the Unix timestamp
&lt;/h3&gt;

&lt;p&gt;This is the part that trips people up. You need the &lt;em&gt;exact&lt;/em&gt; Unix timestamp for the date/time you want, in seconds (not milliseconds — that's a common bug, since JavaScript's &lt;code&gt;Date.now()&lt;/code&gt; returns milliseconds by default).&lt;/p&gt;

&lt;p&gt;In JavaScript:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;unixSeconds&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;floor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or for a specific future date:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;eventDate&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;2026-08-01T18:00:00Z&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;unixSeconds&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;floor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;eventDate&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getTime&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then wrap it: &lt;code&gt;&amp;lt;t:${unixSeconds}:F&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  A shortcut if you don't want to do the math
&lt;/h3&gt;

&lt;p&gt;Since doing this manually for every event, deadline, or announcement gets tedious fast, I built a small free tool that generates all 7 formats at once from a date picker, with a live preview of how each one will actually render: &lt;a href="https://discordtimestampgenerator.com" rel="noopener noreferrer"&gt;discordtimestampgenerator.com&lt;/a&gt;. No signup, just pick a date and copy the format you need. It also has a Unix timestamp converter and a Snowflake ID decoder if you're working with Discord's API and need to pull a timestamp out of a message or user ID.&lt;/p&gt;

&lt;h3&gt;
  
  
  Bonus: timestamps hidden inside Snowflake IDs
&lt;/h3&gt;

&lt;p&gt;Every Discord ID (message, user, channel, server) is a Snowflake — a 64-bit number that encodes a creation timestamp in its first 42 bits, offset from Discord's epoch (&lt;code&gt;1420070400000&lt;/code&gt;, or Jan 1, 2015). That means you can extract &lt;em&gt;when&lt;/em&gt; any message or account was created directly from its ID, without an API call:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;DISCORD_EPOCH&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1420070400000&lt;/span&gt;&lt;span class="nx"&gt;n&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;snowflakeToDate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;snowflake&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;ms&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;BigInt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;snowflake&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;22&lt;/span&gt;&lt;span class="nx"&gt;n&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;DISCORD_EPOCH&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;ms&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Useful for bot developers debugging account age checks, message ordering, or anti-spam logic.&lt;/p&gt;

&lt;p&gt;That's really the whole system — one Markdown pattern, a Unix timestamp, and a format flag. Once you know the syntax, you'll probably never type a manual date in a Discord message again.&lt;/p&gt;

</description>
      <category>discord</category>
      <category>webdev</category>
      <category>javascript</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
