Epoch Time to PST Converter: How to Convert Unix Timestamps
The calculator for this page is switched off while it is checked. The formula is below, and the worked example in the article shows how to use it by hand.
This page explains how to convert an epoch time (Unix timestamp) to Pacific Standard Time (PST) and provides a calculator that does the conversion for you. You enter a Unix timestamp (seconds since January 1, 1970 UTC) and the calculator returns the corresponding date and time in PST (UTC-8), accounting for Pacific Daylight Time (PDT, UTC-7) during daylight saving periods. The result is shown as a calendar date and 24-hour clock time.
Formula
The conversion uses the relationship between UTC and Pacific time. The Unix epoch is defined as 00:00:00 UTC on January 1, 1970. Pacific Standard Time is 8 hours behind UTC, so the base formula is:
PST time = epoch seconds − 28,800 seconds
Where 28,800 = 8 hours × 3,600 seconds per hour. However, during Pacific Daylight Time (PDT), the offset is 7 hours, so you add one hour back:
PDT time = epoch seconds − 25,200 seconds
In the calculator above, the expression t - 28800 + (is_dst * 3600) applies the 8-hour subtraction, then adds 3,600 seconds (1 hour) if daylight saving is active. The variable is_dst is 1 during PDT and 0 during PST. The result is then formatted as a date and time (the calculator output shows it as a duration from the epoch, but the displayed value is the calendar date and time).
Worked Example
Using the default value of 1,700,000,000 seconds:
- Start with the epoch: 1,700,000,000 seconds since 1970-01-01 00:00:00 UTC.
- Convert to UTC date: 1,700,000,000 seconds = 53 years, 8 months, 14 days after 1970. That gives 2023-11-14 22:13:20 UTC.
- Subtract 8 hours for PST: 22:13:20 − 08:00:00 = 14:13:20 on the same day.
- Check daylight saving: November 14 is after the first Sunday in November, so PDT is not active. The result is PST: 2023-11-14 14:13:20 PST.
The calculator gives the same result for the default input.
Why Epoch Time Is Always UTC
Unix timestamps are defined as the number of seconds since 1970-01-01 00:00:00 UTC, ignoring leap seconds. This means the raw number is the same everywhere on Earth. The conversion to PST is purely a matter of subtracting a fixed offset, but the complication is daylight saving time. PST (UTC-8) is used from the first Sunday in November to the second Sunday in March. PDT (UTC-7) is used the rest of the year. A converter that always subtracts 8 hours will be wrong for about two-thirds of the year.
Most online epoch converters and programming languages (like JavaScript’s toLocaleString or Python’s datetime.fromtimestamp) automatically handle the DST transition by using the system’s timezone database. If you are doing the conversion by hand, you must know the date to determine the correct offset.
How to Use the Calculator
- Enter any positive integer as the epoch timestamp. The typical range is from 0 (1970) to about 2.1 billion (2038) for 32-bit systems, but 64-bit systems can handle far larger values.
- The output shows the date and time in Pacific time, with the correct DST offset applied based on the date of the timestamp.
- If you have a timestamp in milliseconds (common in JavaScript), divide it by 1000 before entering it.
- The result is in 24-hour format. For 12-hour format, subtract 12 from hours greater than 12 and add PM.
Common Mistakes and Misconceptions
A frequent error is treating the epoch as if it were already in local time. For example, a timestamp of 0 corresponds to 1969-12-31 16:00:00 PST, not 1970-01-01 00:00:00 PST. Always convert to UTC first, then subtract the offset.
Another misconception is that PST and PDT are interchangeable. They are not: the difference is one hour, and using the wrong one shifts the result by 60 minutes. Always check whether the date falls in daylight saving time.
Also, be careful with time zone abbreviations: “PST” is often used loosely to mean Pacific time in general, but technically it only refers to the standard time. The calculator above handles both.
Alternatives to Manual Conversion
If you need to convert many timestamps, you can use:
- Command-line tools:
date -d @1700000000on Linux (withTZ=America/Los_Angeles), ordate -r 1700000000on macOS. - Programming: Python’s
datetime.fromtimestamp(1700000000, tz=ZoneInfo("America/Los_Angeles")), or JavaScript’snew Date(1700000000*1000).toLocaleString("en-US", {timeZone:"America/Los_Angeles"}). - Spreadsheets: In Excel,
=((A1/86400)+25569)converts a Unix timestamp to a date, but you must add the timezone offset manually (e.g., subtract 8/24 for PST).
These methods rely on the IANA timezone database, which is the same data used by this calculator.
Limitations of the Formula
The simple subtraction formula works for dates after 1970 and before the year 2038 (for 32-bit systems). For timestamps before 1970 (negative numbers), the offset still applies, but the calendar formatting may need special handling. Also, the formula assumes the standard DST rules for the United States, which have changed historically (e.g., the Energy Policy Act of 2005 extended DST). For dates before 2007, the DST transition dates were different. The calculator uses the current rules, which apply to most recent timestamps.
Leap seconds are ignored, as they are in the Unix epoch definition. This causes a discrepancy of a few seconds for timestamps after 1972, but it is negligible for most practical uses.
Frequently Asked Questions
What is the difference between PST and PDT?
PST (Pacific Standard Time) is UTC-8, used from early November to mid-March. PDT (Pacific Daylight Time) is UTC-7, used from mid-March to early November. The switch occurs on the second Sunday in March (clocks forward) and the first Sunday in November (clocks back).
How do I convert a timestamp in milliseconds to seconds?
Divide the millisecond value by 1000. For example, 1700000000000 milliseconds divided by 1000 equals 1700000000 seconds. Many programming languages and APIs return timestamps in milliseconds, so this is a common step.
Why does my epoch converter show a different time than expected?
Check whether your converter is applying the correct DST offset. Some converters always use PST, ignoring DST. Also verify that the input is in seconds, not milliseconds, and that you are not accidentally converting from a different timezone (e.g., UTC vs. local).
Can I convert a timestamp to PST without a calculator?
Yes, if you know the UTC date and time. Subtract 8 hours for PST or 7 hours for PDT. For example, if UTC is 20:00 on July 1, PDT is 13:00 (1 PM) the same day. You must determine the DST status from the date.
What is the epoch time for January 1, 2024 00:00 PST?
January 1 is in PST (UTC-8). The UTC time is 08:00 on January 1, 2024. The epoch for that instant is 1704067200 seconds. You can verify by entering that timestamp into the calculator.