- What is the Unix epoch?
- The Unix epoch is midnight UTC on January 1, 1970 — the starting point for all Unix timestamps. Every timestamp value is the number of seconds (or smaller units) elapsed since then, which makes timestamps timezone-neutral and easy to compare across different systems.
- How do I get the current Unix timestamp in code?
- In JavaScript: Date.now() for milliseconds, or Math.floor(Date.now() / 1000) for seconds. In Python: int(time.time()) for seconds, int(time.time() * 1000) for milliseconds. In Bash: date +%s. Each returns the same moment in a different precision unit.
- Why does my timestamp show a date in 1970?
- The raw value is probably zero or very close to it. This happens when a variable was never assigned, a null field got parsed as 0, or an integer overflowed back to zero. Check the source data — the 1970 date in the output is the symptom, not the bug.
- Can Unix timestamps represent dates before 1970?
- Yes, using negative values. -86400 equals December 31, 1969, 00:00:00 UTC. Most modern 64-bit systems handle negative timestamps correctly. Some older embedded systems may not support pre-epoch dates, but the limitation is in the system, not the timestamp format.
- What is the Year 2038 problem?
- Unix timestamp 2147483647 — the largest 32-bit signed integer — corresponds to January 19, 2038, 03:14:07 UTC. Systems storing timestamps as 32-bit signed integers will overflow to a large negative number after that point. 64-bit systems are not affected.