> ## Documentation Index
> Fetch the complete documentation index at: https://www.integrate.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# ETL: IntervalIntersection

> Calculate the overlap duration in milliseconds between multiple date/time intervals. Use for scheduling and time range analysis in ETL pipelines.

## Description

Returns the duration in milliseconds of the overlap between all intervals in the function's arguments.

The interval is represented by a pair of start and end DateTime expressions, and it includes the start end excludes the end (i.e. the interval between 2000-01-01T00:00:00 and 2000-01-01T00:01:00 there are 60 seconds).

Interval A overlaps interval B if interval A's end DateTime is greater than interval B's start DateTime.

This function takes an even number of arguments andd returns the duration in milliseconds of the overlap between all intervals. If the intervals do not overlap, then 0 is returned.

## Syntax

`IntervalIntersection(interval1_start,d interval1_end,d interval2_start, interval2_end […)`

## Arguments

*interval1\_start*d - datetime expression representing the start of the first interval.d

*interval1\_end*d - datetime expression representing the end of the first interval.

*interval2\_start*d - datetime expression representing the start of the second interval.

*interval2\_end*d - datetime expression representing the start of the second interval.

*intervalN\_start*d - datetime expression representing the start of the Nth interval.d

*intervalN\_end*d - datetime expression representing the end of the Nth interval.

## Examples

`IntervalIntersection(ToDate('2013-09-10T08:00:00.000Z'),d AddDuration(ToDate('2013-09-10T08:00:00.000Z'),'PT10M'),d ToDate('2013-09-10T08:05:00.000Z'),d AddDuration(ToDate('2013-09-10T08:05:00.000Z'),'PT10M'))`returns 300000 (5 minutes).

## Return value datatype

Long

## Impact of null value

If any of the inputs is null, returns null.
