Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

On GNU/Linux, print the number of complete 24-hour days since the Unix epoch with:

echo $(( $(date -u +%s) / 86400 ))

The Unix epoch—also called the Linux epoch for this purpose—began at 1970-01-01 00:00:00 UTC. The command gets the current time as epoch seconds, then divides by 86,400 seconds per day.

What the command calculates

  1. date -u uses UTC, avoiding dependence on the computer’s configured local timezone.
  2. +%s tells GNU date to output seconds since 1970-01-01 00:00:00 UTC.
  3. The shell arithmetic divides those seconds by 86400, the number of seconds in a nominal 24-hour day.

Because shell integer division drops the remainder, the result is the count of complete 24-hour periods elapsed—not a rounded-up count or a calendar-day count. At the epoch itself, the result is zero.

GNU Coreutils documents the epoch definition and conversion of dates to seconds; for example, its documentation shows that 1970-01-01 00:02:00 UTC converts to 120 seconds. GNU Coreutils: Seconds since the Epoch.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Get the day count for a specific date

For example, to find the whole-day count at midnight UTC on October 2, 2026, run:

echo $(( $(date -u -d '2026-10-02 00:00:00' +%s) / 86400 ))

Replace the date and time with the value you want. The -d option parses the supplied date, while -u interprets it in UTC. If you omit a timezone and -u, GNU date uses the host’s local timezone, which can affect the timestamp—especially near daylight-saving transitions.

Find the number of days between two dates

Convert both dates to epoch seconds using the same UTC reference time, subtract the earlier timestamp from the later one, then divide by 86,400:

d1=$(date -u -d '2020-01-01 12:00' +%s)
d2=$(date -u -d '2026-10-02 12:00' +%s)
echo $(( (d2 - d1) / 86400 ))

Using noon UTC for both dates gives a consistent point within each day and avoids daylight-saving changes in the local timezone. GNU’s FAQ notes that date has no direct command for finding days between dates and recommends converting to seconds, subtracting, and dividing by 86,400. GNU Coreutils FAQ.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

GNU/Linux limits and date edge cases

The options and format used here are GNU date features. In particular, -d (also written --date) parses a supplied date, and %s outputs seconds since the epoch. These forms may not work on non-GNU Unix systems; check the system’s date documentation before using them in a portable script. The Linux date(1) manual documents %s and examples of parsing an epoch value: Linux date(1) manual.

  • Before 1970: GNU systems support negative epoch seconds and negative day values. For example, epoch value @-1 is 1969-12-31 23:59:59 UTC. The GNU manual defines @0 as the start of the epoch and explains negative values: GNU Coreutils: Seconds since the Epoch.
  • Leap seconds: Most hosts ignore them. The result is therefore a count based on nominal 86,400-second days, not a tally that separately counts leap seconds. GNU Coreutils: Seconds since the Epoch.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.