Developer Guide
Convert Date to Timestamp
Turn a calendar date into Unix epoch seconds. Covers the local datetime picker versus UTC, Use Now, Y2038, and JWT exp.
Going from a civil date to a Unix timestamp means picking an instant, then counting seconds from 1970-01-01 00:00:00 UTC. Midnight on a picker is midnight in some timezone. If that timezone is not UTC, the integer will not be 1704067200 even if the calendar says 1 January 2024.
/tools/timestamp in → Timestamp mode uses an HTML datetime-local input: the value is local to the browser, then converted with Date and floored to seconds. Use Now fills the picker with the current local minute. This page is that construction path. Reading an existing integer is the timestamp-to-date guide.
The picker is local, not UTC
datetime-local has no Z suffix. 2024-01-01T00:00 means midnight in the zone the OS is using. In UTC that is 1704067200. In IST (UTC+5:30) that same picker value is 2023-12-31 18:30 UTC, which is 1704047400.
If a spec says “00:00 UTC on 1 January 2024,” either set the machine to UTC, subtract the offset yourself, or convert a known-good integer on → Date until the formatted local time matches. /tools/timestamp-ist has its own IST picker when the civil time you hold is Indian wall time.
Use Now
Use Now on → Timestamp writes the current local YYYY-MM-DDTHH:mm into the picker and immediately emits Math.floor(Date.now() / 1000). That is the value to drop into a log, a created_at integer, or a short-lived token you are minting by hand.
On → Date, Use Now fills the seconds field instead. Same instant, opposite direction. Clear resets both. Copy Result copies the integer, which is what APIs want — not the formatted date.
Seconds, not JavaScript milliseconds
The output is ten digits for present-day dates (1704067200, 1700000000). Date.now() in JavaScript is thirteen digits. If you paste the converter’s output into new Date(ts) without multiplying by 1000, you get a 1970 date. If you store Date.now() in a column named unix or in JWT exp, you get the opposite disaster.
Floor after dividing. Do not round up a half-second into the next expiry unless you intend to.
Y2038 and 32-bit columns
A signed 32-bit integer tops out at 2147483647, which is 2038-01-19 03:14:07 UTC. Dates beyond that overflow an INT column. Store epoch seconds in BIGINT, or use a native timestamptz type.
The converter itself will emit integers past 2038; the database is what breaks. If you inherit a 32-bit column, migrate before you schedule jobs for 2039. Milliseconds never fit in 32 bits for modern dates — they are already 13 digits.
JWT exp, iat, and nbf
RFC 7519 NumericDate is seconds. A one-hour token issued at 1700000000 expires at 1700003600. Build those values here, then paste the JWT into /tools/jwt-debugger and confirm the UTC line matches what you meant.
Do not take Date.now() from the browser console and drop it into exp. Do not use a local midnight picker when the auth server compares against UTC. Clock skew of a minute is normal; a five-and-a-half-hour IST offset is a picker mistake, not skew.
Common pitfalls
Assuming the picker is UTC is how New Year jobs fire at 18:30 UTC from an IST laptop. Storing milliseconds in a seconds API is how every token looks expired or immortal. Using INT instead of BIGINT is how 2038 becomes an incident.
Also: converting a date-only string (2024-01-01) in some languages as UTC midnight and in others as local midnight. Prefer an explicit time and zone, or generate the integer once on /tools/timestamp and commit that number in tests.
- → Timestamp on
/tools/timestampuses the browser’s local zone. 1704067200is 2024-01-01 00:00:00 UTC, not “local New Year.”- JWT
expis seconds — inspect on/tools/jwt-debugger.
Worked examples
UTC New Year 2024
2024-01-01 00:00:00 UTC1704067200Only if the picker is in UTC, or you compensate for the offset. IST midnight that day is 1704047400.
A fixed instant from logs
2023-11-14 22:13:20 UTC1700000000Same instant the timestamp-to-date guide starts from. Round-trip both directions before you ship a formula.
Y2038 ceiling (signed 32-bit)
2038-01-19 03:14:07 UTC2147483647Last second an INT column can store. Use BIGINT for anything you expect to keep.
Frequently asked questions
Why is my timestamp 19800 seconds off?
IST is UTC+5:30 (19800 seconds). The picker used local midnight. For Indian wall time use /tools/timestamp-ist; for UTC, account for the offset.
Should I emit milliseconds?
Only if the API documents 13-digit values. /tools/timestamp emits seconds. JWT exp / iat / nbf are seconds.
What does Use Now do?
On → Timestamp it fills the local picker and outputs Math.floor(Date.now() / 1000). On → Date it fills the seconds field with that same count.
Will this site overflow in 2038?
The converter uses JavaScript numbers and will format post-2038 dates. Your INT column will not. Switch to BIGINT (or timestamptz) in the database.
Does picking a date upload it?
No. Date math runs in the browser. Nothing is posted to thedevtools.in.
Summary
Construct a Unix timestamp from an explicit instant: local picker on /tools/timestamp → Timestamp, Use Now for “right now,” and seconds — not Date.now() milliseconds — for JWT exp. Watch Y2038 on 32-bit columns. Reading an integer back into a date is the other guide.