Detect and normalize a Unix value

Paste an integer. The detector identifies the likely unit, converts it to Discord seconds, and rejects unsafe input.


          
        

Discord uses seconds

Discord’s formatting reference says timestamps are expressed in seconds Discord docs. A current value therefore has about 10 digits. A current millisecond value has about 13 digits.

JavaScript uses milliseconds

ECMAScript defines Date time values at millisecond precision from the epoch at the start of January 1, 1970 UTC ECMAScript. Convert a Date value before placing it in Discord syntax:

const seconds = Math.floor(date.getTime() / 1000);
const code = `<t:${seconds}:F>`;

Detect by magnitude, then validate as a date

A magnitude check is a useful first pass: values above about 100000000000 are likely milliseconds for modern dates. Then convert the value to a date and confirm that the year matches the intended event.

Do not remove the last three digits blindly from an unknown value. Parse, normalize, and display the result first.

Seconds and milliseconds example

InputLikely unitDiscord seconds
1785456000Seconds1785456000
1785456000000Milliseconds1785456000

Both rows represent the same instant after normalization.

Bottom line

Normalize to integer seconds, preview the resulting year and UTC instant, then build the Discord code.

Open the full Discord Time Converter

Sources and test pages

  1. Discord Developer Documentation — Message Formatting Primary reference for timestamp syntax, seconds, local rendering, and the nine current styles.
  2. ECMAScript Language Specification — Date Objects Primary specification for JavaScript time values and their millisecond precision.