Contact

HOUR Function (OpenOffice Calc)

Date & Time Intermediate OpenOffice Calc

Learn the HOUR function in Apache OpenOffice Calc: Extracts the hour component of a time value, with source-checked rounding boundaries.

Verification status: See the evidence and test scope described in this guide. How formula examples are checked

Availability and version history

  • Introduced: Documented by Apache OpenOffice 4.1.16; original introduction not established.
  • Availability: Supported in Apache OpenOffice 4.1.16, verified against its function registry. This identifies a supported release, not a final working version.
  • Scope: Desktop Calc, using the English function name. Availability in other spreadsheet applications is separate.
  • Checked: 2026-10-14 — function reference; versioned support. Documentation/source check; not a new native test. Existing example-specific test claims below retain their stated scope.

HOUR extracts the clock-hour component of a numeric time or date-time. For ordinary whole-second times the result is 0 through 23. The pinned OpenOffice callback first rounds the fractional day to a whole second; near midnight, that source rule can produce 24 rather than wrapping the extracted hour back to 0.

Syntax and arguments

=HOUR(time_value)

One numeric time/date-time is required. The callback subtracts approximate floor of the input to remove whole days, converts the fraction to seconds, rounds using approximate floor(seconds+0.5), then uses integer division by 3600. It is a clock-component operation, not total elapsed hours. The fractional-second boundary described here is source-derived, not a native measurement. Examples use English function names and semicolon argument separators.

Reproducible examples

Formula Expected result
=HOUR(TIME(14;30;0)) 14
=HOUR(TIME(0;0;0)) 0
=HOUR(TIME(23;59;59)) 23
=HOUR(1.5) 12
=HOUR(-0.25) 18
=HOUR(86399.75/86400) 24

The first formula preserves the original example and result. Its historical comparable LibreOffice 25.2 check was not an OpenOffice test. New calendar and time results are independently checked reference expectations, not captured native cells. Calendar dates use ISO notation and clock results use HH:MM:SS to avoid ambiguous display conventions.

Practical worksheet: bucket whole-second event times by hour

Enter =TIME(8;15;0), =TIME(12;0;30) and =TIME(17;45;15) in A2:A4. In B2 enter =HOUR(A2) and fill down. Results are 8, 12 and 17. In C2 use =IF(B2<12;"Morning";"Afternoon"), giving Morning, Afternoon and Afternoon under this explicitly chosen noon boundary.

The label is based on local numeric clock values; no timezone is embedded. A date-time such as DATE(2026;10;15)+TIME(17;45;15) gives the same hour 17 in the source model. Keep the date and timezone context elsewhere when grouping real timestamps.

Advanced applications

Do not lose complete elapsed days. The numeric duration 1.5 days is 36 hours, but HOUR(1.5) is 12 because the whole day is removed. To obtain total hours from a day-valued duration, multiply by 24. This is a different operation from extracting a clock component.

Inspect rounding near a boundary. A fractional day equal to 86399.75/86400 represents 23:59:59.75. The source rounds to 86,400 seconds and divides by 3,600, yielding HOUR=24. MINUTE and SECOND instead apply their remainder steps and yield 0. The original date part is not advanced by extracting these components. Avoid reassembling the result as if it were a guaranteed normalized 0–23 clock.

Handle an overnight interval with dates. Let A2 be DATE(2026;10;15)+TIME(23;0;0), and B2 DATE(2026;10;16)+TIME(1;30;0). (B2-A2)*24 gives 2.5 elapsed hours. HOUR(B2)-HOUR(A2) gives -22 and is not an interval calculation.

Errors, edge cases and troubleshooting

Fractional-second rounding can change the hour at a boundary. The table deliberately distinguishes whole-second controls from the source-only 24-hour result near midnight; this prevents the nominal 0–23 description from being treated as an unconditional guarantee. No native floating-point boundary test was run.

A decimal such as 14.5 is measured in days when supplied directly as a serial, not in clock hours. HOUR(14.5) therefore examines its half-day fraction. Use TIME(14;30;0) to construct 14:30, or divide elapsed hours by 24 when that is the intended unit.

Negative serials use the fraction remaining after floor: -0.25 leaves 0.75 and yields hour 18 in the source model. This does not make HOUR a signed-duration extractor. Text/blank coercion, localized input and extreme numeric values are unverified. Format the extracted result as a number and retain the original numeric timestamp for diagnosis.

Documentation and verification

See the Apache OpenOffice HOUR reference, 4.1.16 function resources and versioned date/time interpreter. Official source snapshots were retrieved October 13, 2026 and re-read for this guide. The calculations use an independent calendar and exact rational day-fraction model; no fresh native/headless application or GUI execution is claimed. First introduction and final functioning version remain unknown, separate from documented 4.1.16 support.