What is UNIX time?
UNIX time (also called a UNIX timestamp or POSIX time) is the number of seconds that have elapsed since the UNIX epoch, 1970-01-01 00:00:00 UTC. It is a universal, language-neutral way to represent a moment in time as a single integer, used throughout computing for logs, databases, APIs and programming. No leap seconds are applied — every day is treated as exactly 86,400 seconds.
How to use this calculator
Enter the calendar date (year, month, day) and the time (hour, minute, second) as they appear on a local wall clock. Then set the "Time difference from UTC" to the timezone offset of that local time in hours. For example, Japan is +9, India is +5.5, and US Pacific Standard Time is -8. The default offset is +9 (Japan time). Leave hour, minute and second blank to treat them as zero.
The formula explained
First the date is converted to a day count using the days-from-civil algorithm (by Howard Hinnant), which correctly counts days from the epoch for any Gregorian date, including leap years and pre-1970 dates. That day count is multiplied by 86,400 and the hours, minutes and seconds are added to get the seconds since 1970-01-01 00:00:00 in local time. Finally the UTC offset (in hours × 3600) is subtracted to shift the result to UTC.
$$\begin{gathered} t = 86400 \cdot D + 3600\,\text{Hour} + 60\,\text{Minute} + \text{Second} - 3600\,\text{UTC Offset} \\[1.5em] \text{where}\quad \left\{ \begin{aligned} D &= \text{days from } 1970\text{-}01\text{-}01 \text{ to the chosen date} \\ \text{date} &= \left(\text{Year},\ \text{Month},\ \text{Day}\right) \end{aligned} \right. \end{gathered}$$
Worked example
For 2025-06-15 00:00:00 at offset +9: daysSinceEpoch = 20254, so localSeconds = 20254 × 86400 = 1,749,945,600.
$$\text{localSeconds} = 20254 \times 86400 = 1{,}749{,}945{,}600$$Subtracting 9 × 3600 = 32,400 gives a UNIX time of 1,749,913,200, which is 2025-06-14 15:00:00 UTC.
$$1{,}749{,}945{,}600 - 9 \times 3600 = 1{,}749{,}945{,}600 - 32{,}400 = 1{,}749{,}913{,}200$$FAQ
Why is the timestamp smaller than I expect for a positive offset? Because a local time ahead of UTC corresponds to an earlier UTC instant, so its UNIX value is lower than the same wall clock read as UTC.
Can it handle dates before 1970? Yes — the result is simply negative. 1969-12-31 23:59:59 UTC is \(-1\).
Are leap seconds included? No. This follows the standard POSIX definition where every day is exactly 86,400 seconds.