1 Reply Latest reply on Jun 5, 2014 3:51 AM by BKBK

# CFIF today is between dates do this?

So here is the logic I have I just can t figure how to code

If the date is between 5/31/2014 after 3:00 PM  and 6/7/2014 up to 3:00PM

<CFSET payweek =1>

If the date is between 6/7/2014 after 3:00 PM  and 6/14/2014 up to 3:00PM

<CFSET payweek =2>

If the date is between 6/14/2014 after 3:00 PM  and 6/21/2014 up to 3:00PM

<CFSET payweek =3>

I know I could code all of the weeks but isn't there a way to do this with a loop when you have know starting date 5/31/2014 and time and set length 7 days?

• ###### 1. Re: CFIF today is between dates do this?

Take your pick from these 2 alternatives:

<cfif theDate GTE createdatetime(2014,5,31,15,0,0) AND theDate LTE createdatetime(2014,6,7,14,59,59)>

<CFSET payweek =1>

<cfelseif theDate GTE createdatetime(2014,6,7,15,0,0) AND theDate LTE createdatetime(2014,6,14,14,59,59)>

<CFSET payweek =2>

<cfelseif theDate GTE createdatetime(2014,6,14,15,0,0) AND theDate LTE createdatetime(2014,6,21,14,59,59)>

<CFSET payweek =3>

</cfif>

<cfif theDate GTE createdatetime(2014,5,31,15,0,1) AND theDate LTE createdatetime(2014,6,7,15,0,0)>

<CFSET payweek =1>

<cfelseif theDate GTE createdatetime(2014,6,7,15,0,1) AND theDate LTE createdatetime(2014,6,14,15,0,0)>

<CFSET payweek =2>

<cfelseif theDate GTE createdatetime(2014,6,14,15,0,1) AND theDate LTE createdatetime(2014,6,21,15,0,0)>

<CFSET payweek =3>

</cfif>