Articles
Published · November 18, 2026

Unix Timestamps in Logs and Notes: What the Number Means

A Unix timestamp is the count of seconds since 1 January 1970 UTC. Here is how to read one, convert it with date on a Mac, and keep notes readable.

Also in: Español中文हिन्दी

Quick answer

A Unix timestamp is the number of seconds that have passed since 00:00:00 UTC on 1 January 1970, a moment called the Unix epoch. A number like 31536000 in a log or a note isn't a random ID. It's a point in time, and on a Mac you can turn it into a readable date with date -r. Below: what the number counts, how to convert it, and where it runs out.

What the number counts

Unix time measures time by the number of non-leap seconds that have elapsed since the Unix epoch. Zero is exactly midnight UTC on 1 January 1970. One year later, 00:00:00 UTC on 1 January 1971, is 31536000. That's 365 days of 86,400 seconds each.

The format is also called "epoch time", though the same source calls that name misleading, because other systems use other epochs. When you see a bare number, assume Unix time only if the context says so.

Why leap seconds are ignored

In Unix time, every day contains exactly 86,400 seconds. A leap second does not get a number of its own. It reuses the timestamp of a second next to it, so a number repeats after a positive leap second. Subtract two timestamps across a leap second and your answer is off by one. For notes and logs that rarely matters, but it explains why the count and a wall clock can differ.

Reading a timestamp on macOS with date -r

On macOS, date is a BSD utility, and its -r option does the conversion. Per the macOS date reference, -r seconds prints the date and time for that many seconds since the Epoch. The value can be written in decimal, octal, or hex.

date -r 31536000
date -u -r 31536000

The first command prints the time in your local zone. Adding -u displays it in UTC, so the second prints Fri Jan 1 00:00:00 UTC 1971, using the default format %a %b %e %H:%M:%S %Z %Y. Use -u whenever you want to compare a timestamp against a log from another machine.

Choosing your own output format

An operand starting with + sets the output format, using the conversion specifications from strftime(3):

date -u -r 31536000 +"%Y-%m-%dT%H:%M:%S%Z"

That prints the same moment in a sortable shape. Our guide to strftime format codes lists the codes you will use most.

Getting the current timestamp and building one from a date

To go the other way, use the %s conversion. Apple's strftime manual page defines it as the number of seconds since the Epoch, UTC. Because date accepts strftime formats after a +, this prints the current timestamp:

date +%s

To convert a written date into a timestamp, combine -j with -f. The -f option parses the date you give it with strptime(3), and -j tells date not to set the clock:

date -j -u -f "%Y-%m-%d %H:%M:%S" "1971-01-01 00:00:00" +%s

Give the format every field. Per the same reference, any component the format leaves out is taken from the current time, which can quietly change the result.

Keeping timestamps readable in your notes

A bare number is exact but hard for a person to read. In a log that a program reads, a Unix timestamp is fine. In notes that you read, store a readable stamp instead, or store both:

1763488800  2025-11-18T18:00:00Z  restarted the sync job

The readable part is what you will search for and scan. For choosing that format, see RFC 3339 and ISO 8601 timestamps. If you follow a growing log in the terminal, following a log with tail is a good companion.

When to use it, and when to skip it

Use a Unix timestamp when a program will read the value: it's compact, needs no time zone, and subtracting two of them gives the seconds between events. Skip it in anything you'll scan later, such as a journal, meeting notes, or a changelog, where a stamp like 2025-11-18T18:00:00Z tells you the date at a glance. Both describe the same instant. The difference is who does the converting, and in a note that shouldn't be you.

Limits: negative values and 2038

Unix time is typically encoded as a signed integer, which is how dates before 1970 get negative numbers. A signed 32-bit value covers about 68 years either side of the epoch. One second after 2038-01-19T03:14:07Z it overflows, which is known as the year 2038 problem. Some newer operating systems have widened time_t to 64 bits to avoid it. If you handle old files or embedded devices, check which width your tools use.

How Carets fits in

Timestamps live in plain text: log excerpts, shell snippets, journal entries. Carets is a native notes and code editor for iPhone, iPad, and Mac, so a snippet like date -u -r 31536000 sits in a fenced code block with syntax highlighting, inside a file you own. You can organize those notes into files, projects, and tags, and the files stay portable plain text. Carets won't convert a timestamp for you. It's an editor, not a calculator. Run the command in Terminal and paste the readable result next to the number. Get Carets on the App Store.

Frequently Asked Questions

What is a Unix timestamp?

It is the number of non-leap seconds since 00:00:00 UTC on 1 January 1970, the Unix epoch.

How do I convert a Unix timestamp to a date on a Mac?

Run date -r followed by the number of seconds. Add -u to display the result in UTC.

How do I get the current Unix timestamp?

Run date +%s. The %s conversion prints the number of seconds since the Epoch, UTC.

What is the year 2038 problem?

A signed 32-bit timestamp overflows one second after 2038-01-19T03:14:07Z. Systems that store time in 64 bits are not affected the same way.