Skip to content

multiplyInterval

Description

Returns an interval multiplied by a numeric factor, allowing extrapolation over time.

Note

Both integer and decimal factors are supported.

Syntax

Like many functions in DataPrime, multiplyInterval supports two notations, function and method notation. These interchangeable forms allow flexibility in how you structure expressions.

multiplyInterval(i: interval, factor: number): interval
(i: interval).multiplyInterval(factor: number): interval

Arguments

NameTypeRequiredDescription
iintervaltrueThe interval to multiply
factornumbertrueThe multiplier to apply to the interval

Example

Use case: Estimate total processing time for queued jobs

A document tracks how many jobs remain in the queue and the average time per job in seconds. Multiply the per-job interval by the number of jobs to calculate the total wait time.

{
"jobs_in_queue": 25,
"time_per_job_seconds": 30
}
create overall_wait_time from toInterval(time_per_job_seconds, 's').multiplyInterval(jobs_in_queue)
create overall_wait_time from time_per_job_seconds.toInterval('s').multiplyInterval(jobs_in_queue)

Output

{
"jobs_in_queue": 25,
"time_per_job_seconds": 30,
"overall_wait_time": "12m30s"
}