Views:

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	*/ 
) 

Did you know?

It is Faster, Easier and Smarter using North52

We help you deliver Dynamics 365 projects with complex decision logic/business rules:

FASTER.

Our no code business rules engine helps deliver CRM/CDS projects up to 10 times faster than using custom code.

EASIER.

Simple to use point-and-click interface to build simple or complex business rules.

SMARTER.

Lower your project risk and slash ongoing maintenance costs.

Learn more about the North52 Decision Suite