secToTime()
Format a number of seconds as HH:MM:SS text — display durations computed in other variables for scheduling and time-tracking calculators.
Syntax
Every formula in Calcopolis must start with = in the Value field:
= secToTime(seconds)
| Part | Rule |
|---|---|
| Function name | secToTime — camelCase |
| Arguments | One — seconds (number or expression) |
| Return value | String like "01:05:09" (zero-padded hours, minutes, seconds) |
Valid examples
= secToTime(3661)
= secToTime(duration_sec)
= secToTime(timeToSec(end) - timeToSec(start))
Invalid / unsupported
| Don't write | Why |
|---|---|
secToTime("01:00") |
Argument must be seconds as a number, not a time string |
secToTime() |
The seconds argument is required |
Parameters
| Argument | Description |
|---|---|
seconds |
Total seconds — literal (3600) or variable (duration_sec). |
When to use secToTime()
Use secToTime() on the last step when visitors expect clock formatting:
| Situation | What secToTime() does |
|---|---|
| Elapsed time | Show how long a task takes |
| Remaining SLA | Display time left in HH:MM:SS |
| Session length | Output after subtracting two timeToSec values |
Store math in seconds; convert only for display on a Result or in Custom Text via a formula variable.
Practical examples (ecommerce & leads)
1. Show job duration
| Variable | Formula |
|---|---|
duration_sec |
= timeToSec(end_time) - timeToSec(start_time) |
duration_display |
= secToTime(duration_sec) |
Bind duration_display to a Result widget (text value).
2. Overtime threshold message
| Variable | Formula |
|---|---|
overtime_sec |
= max(duration_sec - 8 * 3600, 0) |
overtime_display |
= secToTime(overtime_sec) |
Where to use it
| Location | Supported |
|---|---|
| Result widget Value | Yes — = ... formulas |
| Standalone variable (Variables tab) | Yes |
| Number / other input default Value | Yes, if formula-driven |
| Visibility formula | Yes |
| Custom Text / Table cells | No — use {{ }} templates there, not = functions |
After editing, run Calculate (or enable Run calculation on load in project Options) to refresh results.
Related
- [
timeToSec()](/docs/reference/formulas/time-to-sec-function/) - Understanding Formulas and Variables —
=syntax and variables - Building Your First Calculator — end-to-end quote calculator