Scenario
Below we have listed examples of Time Ranges to help you understand how to use them / use their syntax.
Each example has their result beneath them in comments.
Functions used in Example
TimeRangeGetIntersection()
TimeRangeIsSamePeriodCheck()
TimeRangeHasInsideCheck()
TimeRangeOverlapsWithCheck()
TimeRangeIntersectsWithCheck()
Formula
Smartflow ( SetVar('TimeRange1a',CreateDate(2016,2,22,14,0)), SetVar('TimeRange1b',CreateDate(2016,2,22,18,00) ), SetVar('TimeRange2a',CreateDate(2016,2,22,15,00) ), SetVar('TimeRange2b',CreateDate(2016,2,22,17,00) ), SetVar('TimeRange3a',CreateDate(2016,2,22,16,00) ), SetVar('TimeRange3b',CreateDate(2016,2,22,21,00) ), TimeRangeGetIntersection(GetVar('TimeRange1a'), GetVar('TimeRange1b'), GetVar('TimeRange2a'), GetVar('TimeRange2b')), /* Result: an Entity Collection with startdatetime = 22.02.2016 15:00:00 and enddatetime 22.02.2016 17:00:00
*/ TimeRangeGetIntersection(GetVar('TimeRange1a'), GetVar('TimeRange1b'), GetVar('TimeRange3a'), GetVar('TimeRange3b')), /*
Result: an Entity Collection with startdatetime = 22.02.2016
16:00:00 and enddatetime 22.02.2016 18:00:00 */ TimeRangeGetIntersection(GetVar('TimeRange3a'), GetVar('TimeRange3b'), GetVar('TimeRange2a'), GetVar('TimeRange2b')), /*
Result: an Entity Collection with startdatetime = 22.02.2016
16:00:00 and enddatetime 22.02.2016 17:00:00 */ TimeRangeIsSamePeriodCheck(GetVar('TimeRange1a'), GetVar('TimeRange1b'), GetVar('TimeRange2a'), GetVar('TimeRange2b')), /* Result: false */ TimeRangeHasInsideCheck(GetVar('TimeRange1a'), GetVar('TimeRange1b'), GetVar('TimeRange2a'), GetVar('TimeRange2b')), /* Result: true */ TimeRangeOverlapsWithCheck(GetVar('TimeRange1a'), GetVar('TimeRange1b'), GetVar('TimeRange2a'), GetVar('TimeRange2b')), /* Result: true */ TimeRangeIntersectsWithCheck(GetVar('TimeRange1a'), GetVar('TimeRange1b'), GetVar('TimeRange2a'), GetVar('TimeRange2b')) /* Result: true */ )