<?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: Sven Schuchardt</title>
    <description>The latest articles on DEV Community by Sven Schuchardt (@sven_schuchardt_0aa51663a).</description>
    <link>https://dev.to/sven_schuchardt_0aa51663a</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3407996%2Ffaba4f7a-c083-4f98-9f6c-e8be76fc17b2.jpg</url>
      <title>DEV Community: Sven Schuchardt</title>
      <link>https://dev.to/sven_schuchardt_0aa51663a</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sven_schuchardt_0aa51663a"/>
    <language>en</language>
    <item>
      <title>JWT Explained: What's Actually Inside a JSON Web Token</title>
      <dc:creator>Sven Schuchardt</dc:creator>
      <pubDate>Fri, 10 Apr 2026 17:09:14 +0000</pubDate>
      <link>https://dev.to/sven_schuchardt_0aa51663a/jwt-explained-whats-actually-inside-a-json-web-token-3o0d</link>
      <guid>https://dev.to/sven_schuchardt_0aa51663a/jwt-explained-whats-actually-inside-a-json-web-token-3o0d</guid>
      <description>&lt;p&gt;You're integrating an API and you get back a token that starts with &lt;code&gt;eyJ&lt;/code&gt;. You paste it somewhere and suddenly you can read your user's email address, their user ID, and an expiry timestamp. No decryption key needed. How? And if anyone can read it, is that secure?&lt;/p&gt;

&lt;p&gt;JWTs look encrypted but aren't. That tension — readable but trustworthy — is the whole point. Understanding it takes about five minutes, and it changes how you think about auth tokens for good.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is a JWT?
&lt;/h2&gt;

&lt;p&gt;A JSON Web Token is three base64url-encoded strings joined by dots:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;header.payload.signature
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Take a real minimal example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VyXzEyMyIsImVtYWlsIjoidXNlckBleGFtcGxlLmNvbSIsImV4cCI6MTcxMjcwMDAwMH0.signature
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each part can be decoded in a browser console right now — no keys, no secrets, no libraries:&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="c1"&gt;// Manually decode the payload (works in any browser console)&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;token&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VyXzEyMyIsImVtYWlsIjoidXNlckBleGFtcGxlLmNvbSIsImV4cCI6MTcxMjcwMDAwMH0.signature&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;payload&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;atob&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;token&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;.&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;/-/g&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;+&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;/_/g&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)));&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="c1"&gt;// { sub: "user_123", email: "user@example.com", exp: 1712700000 }&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Part 1 — Header:&lt;/strong&gt; Contains &lt;code&gt;alg&lt;/code&gt; (the signing algorithm, e.g. &lt;code&gt;HS256&lt;/code&gt; or &lt;code&gt;RS256&lt;/code&gt;) and &lt;code&gt;typ&lt;/code&gt; (always &lt;code&gt;"JWT"&lt;/code&gt;). Decoded, it looks like &lt;code&gt;{ "alg": "HS256", "typ": "JWT" }&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Part 2 — Payload:&lt;/strong&gt; The claims — data statements about the user or token. These are just JSON key-value pairs. Standard claim names are short by convention (&lt;code&gt;sub&lt;/code&gt;, &lt;code&gt;exp&lt;/code&gt;, &lt;code&gt;iat&lt;/code&gt;) but the values can be anything. Custom claims like &lt;code&gt;role&lt;/code&gt; or &lt;code&gt;org_id&lt;/code&gt; are perfectly valid.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Part 3 — Signature:&lt;/strong&gt; An HMAC or RSA hash of &lt;code&gt;base64url(header) + "." + base64url(payload)&lt;/code&gt;, computed using a secret known only to the issuer. This is the part that makes the token trustworthy — not readability, but tamper-evidence.&lt;/p&gt;

&lt;p&gt;The key insight: &lt;strong&gt;JWTs are signed, not encrypted.&lt;/strong&gt; The payload is readable by anyone who has the token. Only the issuer can produce a valid signature.&lt;/p&gt;

&lt;h2&gt;
  
  
  Standard Claims
&lt;/h2&gt;

&lt;p&gt;The JWT spec defines a set of registered claim names. You don't have to use them, but you should — they're understood by every JWT library.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Claim&lt;/th&gt;
&lt;th&gt;Name&lt;/th&gt;
&lt;th&gt;Meaning&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;sub&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Subject&lt;/td&gt;
&lt;td&gt;User identifier (user ID, email, etc.)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;iss&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Issuer&lt;/td&gt;
&lt;td&gt;Who created the token (your auth server)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;aud&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Audience&lt;/td&gt;
&lt;td&gt;Who the token is intended for&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;exp&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Expiration&lt;/td&gt;
&lt;td&gt;Unix timestamp when token expires&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;iat&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Issued at&lt;/td&gt;
&lt;td&gt;Unix timestamp when token was created&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;nbf&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Not before&lt;/td&gt;
&lt;td&gt;Token not valid before this timestamp&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;jti&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;JWT ID&lt;/td&gt;
&lt;td&gt;Unique token identifier (for revocation)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;code&gt;exp&lt;/code&gt; and &lt;code&gt;iat&lt;/code&gt; are Unix timestamps — seconds since January 1 1970. An &lt;code&gt;exp&lt;/code&gt; of &lt;code&gt;1712700000&lt;/code&gt; means the token expires at a specific calendar date and time. Paste any JWT into our &lt;a href="https://biztechbridge.com/tools/jwt-decoder" rel="noopener noreferrer"&gt;JWT decoder tool&lt;/a&gt; to see the header, payload, and claims broken out — without sending the token to any server.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why it Works — and Where it Doesn't
&lt;/h2&gt;

&lt;p&gt;The signature prevents tampering. If you change even one byte of the payload, the signature becomes invalid. The server verifies by re-computing the signature with its own secret and comparing. If they match, the payload hasn't been touched since the issuer signed it.&lt;/p&gt;

&lt;p&gt;But the payload is public. Everyone who holds the token can read it. That means:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Never put passwords, credit card numbers, or API secrets in a JWT payload.&lt;/li&gt;
&lt;li&gt;Never put anything you wouldn't put in a cookie you're okay with users reading.&lt;/li&gt;
&lt;li&gt;Session tokens and user IDs are fine. Sensitive personal data should stay server-side.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A common mistake in early JWT implementations: accepting a token as proof of identity without verifying the signature. A token that decodes to &lt;code&gt;{ "sub": "admin" }&lt;/code&gt; proves nothing on its own — the signature is what proves it came from your auth server. Always verify server-side before trusting any claim.&lt;/p&gt;

&lt;h2&gt;
  
  
  Further Reading
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://jwt.io/introduction" rel="noopener noreferrer"&gt;JWT.io Introduction&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.rfc-editor.org/rfc/rfc7519" rel="noopener noreferrer"&gt;RFC 7519 — JSON Web Token&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/sven-divico/biztechbridge-tools/tree/main/tools/jwt-decoder" rel="noopener noreferrer"&gt;biztechbridge-tools/jwt-decoder&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>jwt</category>
      <category>security</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Unix Timestamps Explained: What Every Developer Should Know</title>
      <dc:creator>Sven Schuchardt</dc:creator>
      <pubDate>Thu, 09 Apr 2026 19:30:59 +0000</pubDate>
      <link>https://dev.to/sven_schuchardt_0aa51663a/unix-timestamps-explained-what-every-developer-should-know-890</link>
      <guid>https://dev.to/sven_schuchardt_0aa51663a/unix-timestamps-explained-what-every-developer-should-know-890</guid>
      <description>&lt;p&gt;You're tailing a log file and you see this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[1712700000] ERROR: connection timeout
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What is &lt;code&gt;1712700000&lt;/code&gt;? Is it a bug? A timestamp? A version number? If you've ever stared at a number like that and felt unsure, this article is for you.&lt;/p&gt;

&lt;p&gt;By the end you'll know exactly what Unix timestamps are, why every serious API uses them, and how to convert them instantly without memorising any formula.&lt;/p&gt;




&lt;h2&gt;
  
  
  What Is a Unix Timestamp?
&lt;/h2&gt;

&lt;p&gt;A Unix timestamp (also called an epoch timestamp) is simply the number of &lt;strong&gt;seconds that have elapsed since January 1, 1970, 00:00:00 UTC&lt;/strong&gt; — a moment arbitrarily chosen as the starting point of computer time, known as the Unix epoch.&lt;/p&gt;

&lt;p&gt;That's it. No timezones, no daylight saving adjustments, no locale quirks. Just a single integer that means the same thing on every machine on the planet.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;1712700000&lt;/code&gt; translates to &lt;strong&gt;April 9, 2024, 20:00:00 UTC&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why 1970?
&lt;/h3&gt;

&lt;p&gt;The Unix operating system was developed in the early 1970s. The designers needed a fixed reference point that was recent enough to keep numbers small but old enough to cover any historical dates they cared about. January 1, 1970 was a clean, round choice that stuck — and 50+ years later the entire industry still uses it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Seconds vs Milliseconds — the most common gotcha
&lt;/h3&gt;

&lt;p&gt;Two variants exist and they will burn you if you mix them up:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Format&lt;/th&gt;
&lt;th&gt;Example&lt;/th&gt;
&lt;th&gt;Used by&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Seconds (Unix time)&lt;/td&gt;
&lt;td&gt;&lt;code&gt;1712700000&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Most Unix APIs, databases, server logs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Milliseconds&lt;/td&gt;
&lt;td&gt;&lt;code&gt;1712700000000&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;JavaScript's &lt;code&gt;Date.now()&lt;/code&gt;, Java, many web APIs&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A 13-digit number is almost always milliseconds. A 10-digit number is almost always seconds. When in doubt, check the API docs.&lt;/p&gt;

&lt;h3&gt;
  
  
  The 2038 problem (a quick aside)
&lt;/h3&gt;

&lt;p&gt;32-bit systems store Unix timestamps as a signed integer, which maxes out on &lt;strong&gt;January 19, 2038&lt;/strong&gt;. Most modern systems use 64-bit integers (which won't overflow until the year 292 billion), but if you're working with embedded systems or legacy C code, it's worth knowing.&lt;/p&gt;




&lt;h2&gt;
  
  
  Converting Epoch to a Human-Readable Date in JavaScript
&lt;/h2&gt;

&lt;p&gt;No library needed. JavaScript's built-in &lt;code&gt;Date&lt;/code&gt; handles it in one line:&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="c1"&gt;// If your timestamp is in seconds, multiply by 1000 first&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;ts&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1712700000&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;date&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="nx"&gt;ts&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;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toISOString&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;
&lt;span class="c1"&gt;// → "2024-04-09T20:00:00.000Z"&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toLocaleString&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;en-US&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;timeZone&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;America/New_York&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;}));&lt;/span&gt;
&lt;span class="c1"&gt;// → "4/9/2024, 4:00:00 PM"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Going the other way — current time as epoch — is even simpler:&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;nowInSeconds&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;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;nowInSeconds&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// → 1712700000 (approximately)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  A debug helper worth bookmarking
&lt;/h3&gt;

&lt;p&gt;When you're debugging logs, paste this into your browser console:&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;fromEpoch&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;ts&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// Handle both seconds and milliseconds automatically&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="nx"&gt;ts&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="nx"&gt;e12&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="nx"&gt;ts&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;ts&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;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="nx"&gt;ms&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;toISOString&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="nf"&gt;fromEpoch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1712700000&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;    &lt;span class="c1"&gt;// → "2024-04-09T20:00:00.000Z"&lt;/span&gt;
&lt;span class="nf"&gt;fromEpoch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1712700000000&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// → "2024-04-09T20:00:00.000Z"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Try It Without Writing Any Code
&lt;/h2&gt;

&lt;p&gt;If you just need a quick conversion — during debugging, code review, or reading API docs — paste any timestamp into our free &lt;a href="https://biztechbridge.com/tools/epoch-converter" rel="noopener noreferrer"&gt;epoch converter tool&lt;/a&gt;. It handles both seconds and milliseconds, supports timezone selection, and works entirely in your browser. No data is ever sent to a server.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why APIs Use Unix Time (and Not ISO Strings)
&lt;/h2&gt;

&lt;p&gt;You'll notice that Stripe, GitHub, Slack, and virtually every major API returns timestamps as integers, not formatted date strings. There are good reasons:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;No timezone ambiguity&lt;/strong&gt; — &lt;code&gt;1712700000&lt;/code&gt; is the same moment everywhere; &lt;code&gt;"2024-04-09 20:00:00"&lt;/code&gt; is meaningless without a timezone&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Easy arithmetic&lt;/strong&gt; — want to check if something happened in the last 24 hours? &lt;code&gt;now - ts &amp;lt; 86400&lt;/code&gt;. Try doing that with ISO strings.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Compact&lt;/strong&gt; — 10 digits vs 24 characters for ISO 8601&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No parsing edge cases&lt;/strong&gt; — no locale formats, no AM/PM, no separator variations&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The tradeoff is readability — which is exactly why tools and debug helpers exist.&lt;/p&gt;




&lt;h2&gt;
  
  
  Key Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A Unix timestamp is seconds since January 1, 1970 UTC&lt;/li&gt;
&lt;li&gt;10 digits = seconds, 13 digits = milliseconds — multiply by 1000 before passing to &lt;code&gt;new Date()&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;APIs use Unix time because it's unambiguous, compact, and arithmetically convenient&lt;/li&gt;
&lt;li&gt;Convert any timestamp instantly with our &lt;a href="https://biztechbridge.com/tools/epoch-converter" rel="noopener noreferrer"&gt;epoch converter tool&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Further Reading
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/now" rel="noopener noreferrer"&gt;MDN: Date.now()&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://en.wikipedia.org/wiki/Unix_time" rel="noopener noreferrer"&gt;Unix time — Wikipedia&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;The full React source for the converter is open on GitHub: &lt;a href="https://github.com/sven-divico/biztechbridge-tools/tree/main/tools/epoch-converter" rel="noopener noreferrer"&gt;biztechbridge-tools/epoch-converter&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>beginners</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
