Time

Timestamp Converter FAQ — Unix Epoch, Date Formats & Time Zones

Answers about Unix timestamps, epoch time, date format conversion, time zones, and how to work with timestamps in code.

Q1 What is a Unix timestamp?

A Unix timestamp is the number of seconds elapsed since January 1, 1970, 00:00:00 UTC (the Unix epoch). It is timezone-independent and universally used in databases, APIs, and logging. Convert any timestamp with the Timestamp Converter.

Q2 How do I convert a Unix timestamp to a date?

Paste the timestamp into the Timestamp Converter. In code: JavaScript — new Date(timestamp * 1000); Python — datetime.fromtimestamp(ts); CLI — date -d @1700000000 (Linux).

Q3 What is the difference between seconds and milliseconds timestamps?

Seconds timestamps are 10 digits (e.g., 1700000000). Millisecond timestamps are 13 digits (e.g., 1700000000000). JavaScript Date.now() returns milliseconds. Python time.time() returns seconds with decimal.

Q4 How do I get the current Unix timestamp?

JavaScript: Math.floor(Date.now() / 1000). Python: import time; int(time.time()). Bash: date +%s. PHP: time(). All return seconds since epoch.

Q5 What is the Year 2038 problem?

32-bit systems store Unix timestamps as a signed 32-bit integer, which overflows on January 19, 2038. Most modern 64-bit systems are immune. Embedded systems may still be affected.

Q6 How do I convert a date to Unix timestamp?

Enter any date/time in the Timestamp Converter. In code: JavaScript — Math.floor(new Date("2024-01-15").getTime() / 1000); Python — int(datetime(2024, 1, 15).timestamp()).

Q7 What is ISO 8601 date format?

ISO 8601 is the international standard: 2024-01-15T14:30:00Z. The T separates date and time, Z means UTC. ISO 8601 is preferred for APIs and data exchange because it is unambiguous and sortable.

Q8 How do I handle time zones in code?

Best practices: (1) store all timestamps in UTC; (2) convert to local time only for display; (3) use timezone-aware datetime objects; (4) use libraries, never manual math. JavaScript: Intl.DateTimeFormat; Python: zoneinfo (3.9+).

Q9 What is UTC?

UTC (Coordinated Universal Time) is the primary time standard. It does not observe daylight saving time. All time zones are offsets from UTC. Servers should store times in UTC to avoid DST ambiguity.

Q10 What is epoch time?

Epoch time is another name for Unix timestamp — seconds since January 1, 1970 UTC. Other systems use different epochs: Windows FILETIME is January 1, 1601; GPS epoch is January 6, 1980.

Q11 How do I format dates in JavaScript?

Use Intl.DateTimeFormat: new Intl.DateTimeFormat('en-US', {dateStyle: 'long'}).format(date). For ISO format: toISOString(). For custom formats, use date-fns or Day.js.

Q12 How do I format dates in Python?

Use strftime: datetime.now().strftime('%Y-%m-%d %H:%M:%S'). Common codes: %Y (year), %m (month), %d (day), %H (hour), %M (minute), %S (second). To parse: datetime.strptime(string, format).

Q13 What is daylight saving time (DST)?

DST shifts clocks forward in spring and back in fall. This creates ambiguous and skipped times. Always use timezone libraries that track DST rules, never hardcode offsets.

Q14 How do I compare timestamps?

Unix timestamps can be compared as numbers — larger = later. For date objects: JavaScript — date1.getTime() === date2.getTime(); Python — datetime1 > datetime2. Always compare in the same timezone (preferably UTC).

Q15 What is the difference between local time and UTC?

Local time includes timezone offset and DST adjustments. UTC is the universal reference with no DST. Store data in UTC, display in local time.

Q16 How do I calculate time difference between two dates?

JavaScript: (date2 - date1) / 1000 gives seconds. Python: (date2 - date1).total_seconds(). For human-readable format, use libraries: date-fns formatDistance(), Python humanize.

Q17 What timestamp format do databases use?

PostgreSQL: TIMESTAMP WITH TIME ZONE (stored as UTC). MySQL: DATETIME or TIMESTAMP. SQLite: text (ISO 8601), integer (Unix), or real (Julian). MongoDB: ISODate (millisecond UTC). Always use timezone-aware columns.

Q18 How do I parse a date string?

JavaScript: new Date('2024-01-15T14:30:00Z') for ISO 8601. Python: datetime.fromisoformat('2024-01-15'). Always specify the format explicitly.

Q19 What is a leap second?

A leap second is an occasional one-second adjustment to UTC. The last one was December 31, 2016. It was decided to abolish leap seconds by 2035.

Q20 How do I store dates in JSON?

JSON has no native date type. Best practice: use ISO 8601 strings or Unix timestamps as numbers. Always include timezone information.

Free Time Tools

All tools run in your browser — no signup, no data sent to servers.

More FAQ Categories