AI Tools Free
Date & Time Calculation Guides

How to Calculate Business Days Between Two Dates (And Convert Unix Timestamps in Excel, SQL, and JS)

Count business days between two dates excluding weekends and holidays, convert 10-digit and 13-digit Unix timestamps in Excel and SQL, and check ISO weeks.

Interactive tool Business Days Calculator
Business Days Calculator Open Free Tool

Ask three people how many business days sit between Monday, October 5 and Friday, October 16 and you will get two different answers: 9 business days (elapsed delivery window excluding the start day) or 10 business days (inclusive payroll workdays). That single off-by-one ambiguity causes missed shipping SLAs, late contract filings, and broken spreadsheet formulas.

Counting Business Days vs. Calendar Days (Handling Weekends and Holidays)

Before calculating working days between two dates, verify whether your use case counts inclusive workdays or net elapsed business days:

  • Payroll and project capacity (inclusive): Counts both the start date and end date if they fall on Monday through Friday. Monday to Friday of the same week = 5 working days.
  • Shipping, banking, and legal SLAs (T+N elapsed): Day 0 is the trigger date (provided the order arrives before the cutoff hour), and Day 1 is the next business day. An order placed on Monday with a "3-business-day SLA" is due by end of day Thursday.

Excel & Google Sheets Working Days Formula: =NETWORKDAYS(start_date, end_date, [holidays_range]). For custom weekend schedules (such as Friday-Saturday weekends or 6-day Mon-Sat operations), use =NETWORKDAYS.INTL(start_date, end_date, weekend_code, [holidays_range]).

Check your exact working-day count across weekends now:

When you need the exact calendar span broken down into years, months, total days, and hours (such as age verification, visa day-count limits, or subscription proration), use the calendar Date Difference Calculator:

Unix Timestamp to Date Formula in Excel, JavaScript, and PostgreSQL

A Unix timestamp (POSIX epoch time) counts the number of non-leap seconds elapsed since 1970-01-01T00:00:00Z (UTC). Because spreadsheet serial dates count days since 1899-12-30 (where 1970-01-01 equals serial day 25569), converting a Unix timestamp in Excel or Google Sheets requires dividing by 86,400 seconds per day and adding DATE(1970,1,1).

Excel Unix Timestamp Formula (10-digit seconds in cell A2): =(A2 / 86400) + DATE(1970, 1, 1). For 13-digit milliseconds (JavaScript Date.now() exports): =(A2 / 86400000) + DATE(1970, 1, 1).

EnvironmentSeconds (1792281600) to UTC DateDate to Unix Seconds
Excel / Sheets=(A2 / 86400) + DATE(1970,1,1)=(A2 - DATE(1970,1,1)) * 86400
JavaScript / Node.jsnew Date(sec * 1000).toISOString()Math.floor(Date.now() / 1000)
PostgreSQLto_timestamp(1792281600) AT TIME ZONE 'UTC'EXTRACT(EPOCH FROM NOW())::bigint
Python 3datetime.fromtimestamp(sec, tz=timezone.utc)int(dt.timestamp())
Linux Bash (GNU)date -u -d @1792281600 +"%Y-%m-%d %H:%M:%S"date +%s

My debugging rule: whenever a converted timestamp lands in the year 58,796 or 1970-01-21, you mixed up seconds (10 digits) and milliseconds (13 digits). JavaScript's Date constructor expects milliseconds, while Python, PHP, PostgreSQL, and Unix cron/JWT exp claims use seconds.

Understanding ISO-8601 Week Numbers (W01 to W53)

Supply-chain schedules, European engineering sprints, and financial reporting frequently reference dates by ISO week (such as 2026-W42). Under ISO-8601:

  1. Every week begins on Monday (Day 1) and ends on Sunday (Day 7).
  2. Week 01 of any year is defined as the week that contains the first Thursday of January (equivalently, the week containing January 4th).

Because of that rule, December 29, 30, or 31 can belong to W01 of the *following* ISO year, and January 1, 2, or 3 can belong to W52 or W53 of the *previous* ISO year. In Excel, never use bare =WEEKNUM(A2) if your team follows ISO weeks; always use =ISOWEEKNUM(A2).

Frequently asked questions

Does Excel NETWORKDAYS include both the start date and the end date?

Yes. Excel's =NETWORKDAYS(start_date, end_date) is inclusive of both endpoints. If start_date is Monday, October 19 and end_date is Friday, October 23 of the same week, NETWORKDAYS returns 5, whereas contractual SLA delivery windows ("within 5 business days") typically start counting on the next business day after the order is placed.

How do I tell whether a Unix timestamp is in seconds or milliseconds?

Check the digit count. A current Unix epoch timestamp in seconds has 10 digits (for example, 1792281600 for October 2026). A timestamp in milliseconds has 13 digits (1792281600000), and nanoseconds have 19 digits. In Excel, divide 13-digit millisecond timestamps by 86,400,000 instead of 86,400.

Why does Week 1 of the year start on a different day in ISO-8601 vs. US calendars?

Under ISO-8601, weeks always start on Monday, and Week 01 is the week containing the year's first Thursday (or January 4th). In standard North American calendars (Excel WEEKNUM default mode 1), weeks start on Sunday and Week 1 begins on January 1st even if January 1st is a Saturday.