SECOND Function (LibreOffice Calc)
The SECOND function extracts the second component (0–59) from a time or datetime value. It is essential for timestamp parsing, logging, scheduling, and cleaning imported time data.
Compatibility
▾| Excel | ✔ |
| Gnumeric | ✔ |
| Google_sheets | ✔ |
| Libreoffice | ✔ |
| Numbers | ✔ |
| Onlyoffice | ✔ |
| Openoffice | ✔ |
| Wps | ✔ |
| Zoho | ✔ |
What the SECOND Function Does ▾
- Extracts the seconds from a time or datetime
- Accepts serial numbers, real times, or converted text
- Returns an integer from 0 to 59
- Ignores hours and minutes
It is designed to be simple, reliable, and ideal for time‑component extraction.
Syntax ▾
SECOND(time_value)
Arguments
- time_value:
A time, datetime, or serial number representing a time.
Basic Examples ▾
Extract seconds from a time
=SECOND("14:30:45")
Returns 45.
Extract seconds from a datetime
=SECOND("2024-03-15 08:45:12")
Returns 12.
Extract seconds from a cell
=SECOND(A1)
Extract seconds from NOW()
=SECOND(NOW())
Advanced Examples ▾
Extract seconds from text using TIMEVALUE
=SECOND(TIMEVALUE(A1))
Extract seconds from ISO timestamp
=SECOND(TIMEVALUE(MID(A1;12;8)))
Extract seconds from imported CSV timestamps
=SECOND(DATEVALUE(LEFT(A1;10)) + TIMEVALUE(MID(A1;12;8)))
Extract seconds from Excel serial dates imported as text
=SECOND(DATE(1899;12;30)+VALUE(A1))
Check if a timestamp is exactly on the minute
=SECOND(A1)=0
Bucket seconds into 10‑second intervals
=INT(SECOND(A1)/10)*10
Extract seconds from a serial number
=SECOND(0.123456)
Remove seconds from a timestamp
=A1 - SECOND(A1)/86400
Edge Cases and Behavior Details ▾
SECOND returns an integer (0–59)
Accepts:
- Real times
- Datetimes
- Serial numbers
- TIMEVALUE outputs
Invalid text → Err:502
SECOND ignores date components
=SECOND("2024-03-15 22:10:33") → 33
SECOND ignores hours and minutes
SECOND of a number > 1
=SECOND(1.5) → 0
(1.5 days = 36:00:00 → seconds = 0)
SECOND of negative values → Err:502
SECOND of an error → error propagates
Common Errors and Fixes ▾
Err:502 — Invalid argument
Cause:
- Text not recognized as a time
- Negative serial numbers
- Non-numeric values
Fix:
- Wrap with TIMEVALUE
- Clean text with TRIM or SUBSTITUTE
Wrong result due to date formatting
Fix:
- Ensure the cell contains a real datetime, not text
Unexpected seconds from serial numbers
Cause:
- Serial numbers represent days, not hours
Fix:
- Use MOD(A1;1) to isolate time portion
Best Practices ▾
- Use SECOND for all second‑extraction tasks
- Use TIMEVALUE to normalize text times
- Use INT or MOD to isolate time components
- Use SECOND with NOW() for dynamic dashboards
- Use SECOND with logical tests for scheduling rules
SECOND is your precision timestamp tool — perfect for logs, scheduling logic, dashboards, and cleaning messy imported time data.
Related Patterns and Alternatives ▾
- Use HOUR and MINUTE for other components
- Use TIME to construct times
- Use TIMEVALUE to convert text
- Use NOW for current datetime
- Use DATE for date construction
By mastering SECOND and its companion functions, you can build powerful, reliable, and fully dynamic time‑based workflows in LibreOffice Calc.