语言: 简体中文

时长相加计算器

在此浏览器中运行。您输入的内容不会发送给 Alinxs。

可用格式:1:30、1:30:15、1h 30m、45m、90s、1.5h,以及 09:00-17:30 这样的时间段。行首加 - 表示减去,# 后的文字为备注。

将 3:45 这类值理解为

合计(时:分:秒)
—
小数小时
—
总分钟数
—

每行的解读

行输入时长

列表(包括 # 备注)和读取方式保存在此浏览器的本地存储中。重置会将其替换为示例列表。

Practical guide

Time Duration Adder — Add Hours, Minutes and Time Ranges

Adding times by hand goes wrong because minutes carry at 60, not 100: 1:45 + 2:30 is 4:15, not 3:75 or 4.15. Paste a timesheet, a list of video or song lengths, or the start and end times of work blocks, one per line. The page reads every line, shows how it was interpreted, and adds them up. Ranges that end after midnight are handled, and lines starting with a minus sign are subtracted, for example an unpaid break.

How to use it

  1. Type or paste one entry per line: 1:45, 1:30:15, 1h 30m, 45m, 90s, 1.5h, or a range such as 09:00-17:30. Text after # is a note and is ignored.
  2. Choose whether a two-part value such as 3:45 means hours:minutes (timesheets) or minutes:seconds (track or video lengths). Ranges are always clock times.
  3. Read the total, decimal hours and total minutes, and check the line table. Fix any line listed in an error; Copy result copies the totals and the table.

Worked example

Input
09:00-12:30 # morning
13:15-17:45
-0:15 # coffee break
Result
Line 1 = 3:30:00, line 2 = 4:30:00, line 3 = -0:15:00. Total 7:45:00 = 7.75 decimal hours = 465 minutes.

How the result is produced

Every line is converted to whole seconds. h:mm:ss is always hours, minutes and seconds; a:b follows the selected mode; in the unit form h, m and s mean hours, minutes and seconds and may carry decimals (with a point or a comma). Full-width and Arabic-Indic digits are read as ordinary digits. A unit-form line is rounded to the nearest whole second, with halves rounded up, so 0.01h is 36 seconds.

A range start-end (a hyphen, en dash, em dash or ~) uses 24-hour clock times from 00:00 to 24:00. If the end is earlier than the start, 24 hours are added because the range crosses midnight; equal times give zero. A leading - (or minus sign or en dash) subtracts the line.

Decimal hours are the total divided by 3,600, rounded half up to two decimals (5:05:00 = 5.08). Total minutes are shown as a whole number when there are no leftover seconds, otherwise to two decimals. While any line has an error, no total is shown.

Important limits

  • It adds durations only. It does not know dates, time zones, daylight-saving changes, AM/PM times, break rules, overtime or pay rates, and it is not a payroll or legal timekeeping record.
  • A range cannot span more than one midnight; enter longer periods as a duration such as 30h. One line can be at most 99,999 hours, the total also, and the list at most 500 non-blank lines.
  • Only the letters h, m and s are recognised as units, and a bare number such as 90 is rejected because its unit is unclear. Thousands separators are rejected too: 1,500s could mean 1500 or 1.5, so write 1500s or 1.5s.

Questions and answers

Why is 5:05 shown as 5.08 hours, not 5.05?

Five minutes is 5/60 of an hour, about 0.083. Payroll and invoicing tools usually expect this decimal form, while h:mm:ss is the clock form.

How do I subtract a lunch break?

Add a line such as -0:30 # lunch. The table marks it as subtracted, and the total can become negative if you subtract more than you add.

Is what I type saved?

The list, including notes after #, and the mode are kept in this browser’s local storage so they are there after a reload. Reset replaces them with the sample list. Nothing is sent to a server.