Unix Timestamps Explained: Seconds, Milliseconds, and Time Zones
Debug dates that land in 1970, convert between epoch units, and distinguish a timestamp's instant from the time zone used to display it.
Why does my timestamp show a date in 1970?
A common cause is passing seconds to an interface that expects milliseconds. Unix timestamps commonly count seconds since 1970-01-01 at 00:00:00 UTC. JavaScript Date uses milliseconds since that epoch, so the same instant needs a value one thousand times larger.
For example, 1704067200 seconds and 1704067200000 milliseconds both represent 2024-01-01 at 00:00:00 UTC. Treating the first number as milliseconds produces a date near the start of 1970. A time zone adjustment cannot repair a unit mismatch of that size.
Confirm units before changing time zones
Check the API field documentation or the code that created the value. Current-era second timestamps often have 10 digits and millisecond timestamps 13, but length is only a clue. Older dates, negative timestamps, and other units make a universal digit-count rule unreliable.
StatFlare's converter detects likely units and supports seconds, milliseconds, microseconds, and nanoseconds. Review the detected unit against the source. A plausible-looking date is a useful check, but it is not a substitute for knowing the field's contract.
Try it free: Unix Timestamp Converter
Convert epoch values, compare timezone displays, and inspect batches of up to 200 timestamps.
One instant can have several local clock readings
At the example instant, UTC reads January 1 at midnight, while India Standard Time reads January 1 at 05:30. These are two displays of one instant. Adding an offset to the stored epoch value just to change the displayed time moves the event itself.
Store an instant consistently and choose a display time zone separately. When the source is a local date and time without an offset, first determine which zone was intended. A meeting at 09:00 in one city cannot be converted correctly until that missing context is known.
A repeatable debugging workflow
Save one raw value and its field name. Confirm units, convert to UTC, and compare against an event whose time you know. Then display the same instant in the user's zone. If only the display differs, inspect formatting rather than rewriting the stored timestamp.
In JavaScript, new Date(seconds * 1000) constructs a date from Unix seconds, and date.getTime() returns milliseconds. MDN's Date reference documents this representation. Keep unit names explicit in variables and API contracts so the same mistake does not recur at another boundary.
Frequently asked questions
Does a Unix timestamp contain my local time zone? No. A conventional epoch value describes an instant; the zone is chosen when displaying it.
Can I fix a seconds-versus-milliseconds bug by adding hours? No. Convert the unit first, then inspect the display zone.
Should a birthday be stored as a timestamp? A birthday is usually a calendar date, not a moment on a global clock. Choose a date representation that matches that purpose.
Unix Timestamp Converter
Convert epoch values, compare timezone displays, and inspect batches of up to 200 timestamps.
Written by
Jayesh Gavit
Founder, StatFlare
Jayesh Gavit is the founder of StatFlare, a free YouTube channel analytics platform used by thousands of creators and marketers. He has spent years studying the YouTube algorithm, audience behavior, and creator monetization patterns. Outside of building StatFlare, Jayesh creates videos at @jayeshverse covering software, indie product building, and the creator economy.
Free Tools