How to Convert a Unix Timestamp on Mac (Terminal and Apps)
Convert a Unix timestamp on Mac with the BSD date command (date -r, date +%s), plus milliseconds, other epochs, date math and batch log lines.
GuideUpdated 8 min read
On this page
To convert a Unix timestamp on a Mac, open Terminal and run date -r 1700000000. It prints the date in your local time. For UTC, add -u (date -u -r 1700000000). For the current timestamp, run date +%s.
Many guides tell you to use date -d @1700000000. That is GNU date syntax from Linux. macOS ships the BSD date, which doesn't accept it and prints an error such as illegal option -- d. The commands below are the BSD versions, and they work on macOS 14 Sonoma, 15 Sequoia and 26 Tahoe.
Get the current Unix timestamp (epoch time) with date +%s
date +%sThis prints the number of seconds since 1970-01-01 00:00:00 UTC. The number is the same in every time zone, so you don't need -u.
date +%s only gives whole seconds. If an API expects milliseconds, multiply in the shell:
echo $(( $(date +%s) * 1000 ))This prints the current time in milliseconds, but the last three digits are always 000. Bytepliers can also give you the current time in milliseconds: the Now menu in its Unix Timestamp tool has Unix Milliseconds, and bytepliers ts prints a unix-ms value. Both are covered below.
Convert a Unix timestamp to a date with date -r
date -r 1700000000This prints the date and time in your Mac's time zone. For UTC:
date -u -r 1700000000This prints Tue Nov 14 22:13:20 UTC 2023.
To control the output format, add a + format string at the end:
date -u -r 1700000000 "+%Y-%m-%dT%H:%M:%SZ"This prints ISO 8601 in UTC: 2023-11-14T22:13:20Z. For local time with the UTC offset:
date -r 1700000000 "+%Y-%m-%d %H:%M:%S %z"-r expects whole seconds. Don't include a decimal point, letters or a millisecond value. Milliseconds are covered in the table further down.
Convert a date to a timestamp with date -j -f
date -j -f "%Y-%m-%d %H:%M:%S" "2026-11-11 10:00:00" +%sThis reads the date in your local time zone and prints Unix seconds. -j tells date not to set the system clock. -f gives the input format, and your text must match it exactly.
To read the date as UTC instead, set the time zone for that one command:
TZ=UTC date -j -f "%Y-%m-%d %H:%M:%S" "2026-11-11 10:00:00" +%sAny field you leave out of the format is taken from the current time. If you parse only "%Y-%m-%d", the hour, minute and second come from right now, so the result changes every time you run the command. Always include the time, even if it's 00:00:00.
Milliseconds, microseconds and other epochs
JavaScript's Date.now(), many APIs and many log systems use milliseconds, not seconds. For present-day dates, the number of digits tells you the unit:
| Digits | Unit | Example | Convert with date |
|---|---|---|---|
| 10 | seconds | 1700000000 | date -r 1700000000 |
| 13 | milliseconds | 1700000000123 | date -r $(( 1700000000123 / 1000 )) |
| 16 | microseconds | 1700000000123456 | date -r $(( 1700000000123456 / 1000000 )) |
| 19 | nanoseconds | 1700000000123456789 | date -r $(( 1700000000123456789 / 1000000000 )) |
The $(( )) arithmetic drops the fraction, so the output is accurate to the second.
Some platforms count from a different starting point. To turn their values into Unix seconds:
| Epoch | Counts | Starts | To Unix seconds |
|---|---|---|---|
| Apple reference (Cocoa, Core Data) | seconds | 2001-01-01 UTC | add 978307200 |
| Windows FILETIME | 100-nanosecond intervals | 1601-01-01 UTC | divide by 10,000,000, then subtract 11644473600 |
| Excel serial date | days | 1899-12-30 | subtract 25569, then multiply by 86,400 |
For example, to convert an Apple reference date:
date -u -r $(( 721692000 + 978307200 ))Excel serial dates usually have a fractional part, and shell arithmetic only handles whole numbers. For Excel values, .NET ticks and FILETIME, the Bytepliers tool in the next section is easier.
Convert timestamps in Bytepliers
Bytepliers is our Mac app of offline developer tools. Its Unix Timestamp tool shows a value in several formats at once, so you don't have to remember format strings or work out the unit yourself.
- Open Bytepliers and press ⌘7 (Command-7), or click Unix Timestamp in the sidebar.
- Paste a timestamp or date into the input field.
- Read the output rows: Local, UTC, ISO 8601, ISO 8601 local, Relative, Unix seconds and Unix ms.


The tool accepts:
- Epoch seconds, milliseconds, microseconds or nanoseconds. It works out the unit from the number.
- ISO 8601,
yyyy-MM-dd HH:mm:ssand RFC 2822 dates. - Numbers with digit separators (commas, underscores or spaces). It ignores the separators.
The Numbers picker sets how a bare number is read. The choices are Auto (Unix) (the default), Unix Seconds, Unix Milliseconds, Unix Microseconds, Unix Nanoseconds, Apple Reference, Windows FILETIME, .NET Ticks and Excel Serial Date. In Auto mode, a Could also be row lists other readings of the same number, which helps when you don't know which epoch a value uses.
The Format row takes a custom ICU date pattern. Its Presets menu has RFC 2822, RFC 3339, HTTP Date (GMT), SQL Datetime, Go UnixDate and Go RFC1123Z.
For the current time, look at the input header, which shows the live "now" epoch. You can also use the Now menu. Clicking it inserts Unix seconds, and the menu also has Unix Seconds, Unix Milliseconds, ISO 8601 and Copy Current Timestamp.
If the tool can't read your input, it shows "Not a timestamp, date or expression".
Convert from any app with the Quick Panel
For a quick lookup, you don't need to switch apps:
- Copy the timestamp in any app.
- Press ⌥⌘B (Option-Command-B).
- Read the result. The Quick Panel shows the local time, plus UTC, ISO 8601, relative time and the epoch value.
- Press ⏎ to copy the result and close the panel, or ⎋ to close without copying.
To replace the clipboard contents directly, press ⌥⇧⌘B (Detect & Replace Clipboard). A timestamp becomes ISO 8601, and a date becomes Unix seconds. To undo, choose Tools ▸ Restore Previous Clipboard. You can change both shortcuts in Settings ▸ Shortcuts. The Quick Panel and Instant Replace docs cover both in detail.
Convert from Terminal with bytepliers ts
Bytepliers includes a command-line tool. Install it from Settings ▸ Integrations ▸ Command-Line Tool ▸ Install… (see the bytepliers command-line tool). Then run:
bytepliers ts 1700000000This prints five values: unix, unix-ms, iso-utc, iso-local and relative. Run bytepliers ts with no value to get the same fields for the current time. You can also pass a date instead of a number.
The command works when the app isn't running. It does need a license or an active trial, and you must have opened Bytepliers at least once.
Do date math: now + 90 minutes, 30 days ago
BSD date adjusts dates with -v:
date -v+90MThis prints the time 90 minutes from now.
date -v-30d +%sThis prints the Unix timestamp for 30 days ago.
date -u -r 1700000000 -v+1dThis prints the time one day after a given timestamp, in UTC.
The units are y (years), m (months), w (weeks), d (days), H (hours), M (minutes) and S (seconds). Case matters: -v+90m adds 90 months, not 90 minutes. You can combine adjustments, for example date -v+1d -v-2H.
In Bytepliers, type the expression straight into the Unix Timestamp input:
now + 90m1700000000 + 864002026-11-11 - 30d
The units are s, m, h, d and w, and * and / also work. Here m means minutes, which is the opposite of date. You can also type today, tomorrow and yesterday.
Convert many log lines at once
If a file has one timestamp per line, loop over it in Terminal:
while read -r ts; do date -u -r "$ts" "+%F %T"; done < timestamps.txtThis prints each timestamp as a UTC date and time. The file isn't changed.
If the timestamp is the first field of each log line and you want to keep the rest of the line:
while read -r ts rest; do echo "$(date -u -r "$ts" '+%F %T') $rest"; done < app.logFor millisecond timestamps, replace "$ts" with $(( ts / 1000 )).
In Bytepliers, paste several lines into the Unix Timestamp tool and you get a Table with the columns Input, Local, ISO 8601 (UTC), Unix and Relative. It reads up to 5,000 lines. You can copy the table as tab-separated values and paste it into a spreadsheet. The tool expects one timestamp per line, so if the timestamps are inside longer log lines, extract that column first, for example with cut -d' ' -f1 app.log | pbcopy.


See the time in other zones
In Terminal, set TZ for a single command:
TZ=America/New_York date -r 1700000000This prints the timestamp in New York time. Zone names come from the tz database. To list the names your Mac knows, run ls /usr/share/zoneinfo.
In Bytepliers, open Zones in the Unix Timestamp tool and click Add Zone to choose from a searchable list of cities and zones. The zones you add are saved, so they're still there the next time you open the tool.
Which method to use
| Method | Best for | Milliseconds and other epochs | Batch | Needs |
|---|---|---|---|---|
date in Terminal | Scripts, one-off checks | Manual division and offsets | Shell loop | Nothing, built in |
| Bytepliers Unix Timestamp tool | Seeing every format at once, unknown epochs | Auto-detected, plus a picker | Up to 5,000 lines as a table | Bytepliers |
| Quick Panel (⌥⌘B) | Checking a copied value from any app | Auto-detected | No | Bytepliers |
bytepliers ts | Five formats in Terminal at once | Includes unix-ms | Shell loop | Bytepliers CLI installed |
If you only convert a timestamp now and then, date -r is all you need. Bytepliers helps if you convert timestamps every day, deal with milliseconds or Apple, Windows and Excel dates, or want the answer without leaving the app you're in. Bytepliers is part of MacSuite, and you can try it free for 7 days.
If it doesn't work
illegal option -- dor a usage message: You used GNU syntax (date -d @…). On macOS, usedate -r <seconds>. If you've installed GNU coreutils with Homebrew, the GNU version is available asgdate.- The year is five digits (tens of thousands of years from now): You passed milliseconds as seconds. Divide by 1,000 first:
date -r $(( value / 1000 )). - The time is off by several hours:
dateshows local time by default. Add-ufor UTC, or setTZ=for a specific zone. date -j -fgives a different result each run: The format leaves out the time or seconds, so those fields come from the current time. Include every field in both the format and the input.date -j -fsays the conversion failed: The input doesn't match the format exactly. Check the separators, theTin ISO dates and any time zone suffix.date -fcomplains it isn't permitted: You left out-j, sodatetried to set the system clock. Add-j.
FAQ
Is a Unix timestamp always UTC?
Yes. It counts seconds since 1970-01-01 00:00:00 UTC, so a given moment has the same timestamp everywhere. Time zones only matter when you display it as a date.
Does JavaScript use seconds or milliseconds?
Milliseconds. For current dates, Date.now() returns a 13-digit number. Divide it by 1,000 before passing it to date -r.
Will my Mac have a problem in 2038?
The 2038 limit (2038-01-19 03:14:07 UTC) applies to 32-bit signed timestamps. macOS uses 64-bit time values, so date on a current Mac handles dates well past 2038. Older systems and file formats that store 32-bit values can still overflow.
For related tools, see how to generate a UUID on Mac and the Bytepliers tool reference.