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?

North52 provides Automated Testing for Dynamics 365

TestShield® is a unique solution that helps you automatically test your End to End Dynamics 365/CRM and Power Automate processes.  It is built on the proven and robust North52 Business Process Activities rules engine and offers the ability to repetitively test and report on your key business processes.

TestShield's key features:

  • Fully integrated with Dynamics 365
  • Easy to use by BA's, Testers, and Developers
  • Advanced test data generation and management
  • Codeless advanced testing reduces test creation time
  • Test and validate across all layers with a single test

Learn more about TestShield