Skip to main content
Nintex Community Menu Bar
Answer

Date falls between date range

  • April 5, 2023
  • 6 replies
  • 386 views

Forum|alt.badge.img+1

HI,

I need to check that the current date is between 2 dates in a last (start date and To date)

I have tried the usual if greater than or equal and less than or equal but nothing works the query always returns no results

Anyone know how to do this?

Best answer by Garrett

Hi @chrismccarthy1 

That works too. Your query expression is correct.

I suspect that perhaps the FromDate is greater than the ToDate
or the dtCurrent date is outside of the FromDate < ToDate range.
Use control values for the Dates. FromDate is 1 Jan 2023, ToDate is 31 Dec 2023. 

Use the Conditional Branch. Place a Log to History at both outcome Yes and No
Use another Log to History to display the values of all 3 dates 

6 replies

Garrett
Forum|alt.badge.img+16
  • Scout
  • April 5, 2023

Hi @chrismccarthy1 

 

  1. The 2 dates in the SP List. Confirm that the days are of DateTime type.
  2. Can you post a screenshot of the Query

Garrett
Forum|alt.badge.img+16
  • Scout
  • April 5, 2023

Hi @chrismccarthy1 

Here is an example of comparison. Instead of using dates from the SP List, I will just create variables and set the date values in this example. You should use Dates from the SP columns - however pls verify that DateTime1 <= DateTime2 otherwise the expression will always return False or No

  1. Use a Set Workflow Variable action to create 3 Datetime variables.
    Datetime1 - This is the start Date. 1-Apr
    Datetime2 - This is the end Date. 10-Apr
    DateToday - This is the current Date
  2. Check if DateToday is between Datetime1 and Datetime2.
    Datetime1 <= DateToday <= Datetime2
    Use a Conditional Branch to enter the following expression.

Final Code. 

 


Forum|alt.badge.img+1

Yes both list columns are DateTime 

 

 


Garrett
Forum|alt.badge.img+16
  • Scout
  • Answer
  • April 5, 2023

Hi @chrismccarthy1 

That works too. Your query expression is correct.

I suspect that perhaps the FromDate is greater than the ToDate
or the dtCurrent date is outside of the FromDate < ToDate range.
Use control values for the Dates. FromDate is 1 Jan 2023, ToDate is 31 Dec 2023. 

Use the Conditional Branch. Place a Log to History at both outcome Yes and No
Use another Log to History to display the values of all 3 dates 


Forum|alt.badge.img+1

Hi @Garrett 

Thanks for your help all is working as expected.

Cheers 


Garrett
Forum|alt.badge.img+16
  • Scout
  • April 5, 2023

Hey @chrismccarthy1 

Glad to help

Cheers