Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

How to check Time if it Falls in a Certain Range

HRivera
7 - Meteor

Hi! I'm stuck on a challenge here: I have a time and I want to check if it falls from a certain time range. 

 

HRivera_0-1579589041042.png

 

I want to check if those times falls inside 10PM - 6AM.

 

Please Help,

 

Thanks! 

5 REPLIES 5
ashissanpui
9 - Comet

Check the data type. And the use datetime parse and formula tools to achieve.

vishwa_0308
11 - Bolide

One very simple logic: 

Just extract the hour value in a variable say [Hour] using left function and put those hours in your filter.

 

Like in your case : [Hour] in (22,23,00,01,02,03,04,05,06)

danilang
19 - Altair
19 - Altair

Hi @HRivera 

 

Since you want to look for values between 10 PM and 6AM remove the last 06 from @vishwa_0308s' solution 

 

As a single formula that you could put in a Filter tool, the expression would be  

ToNumber(Left([Field1],2)) in (22,23,0,1,2,3,4,5)

 

Dan

BonusCup
10 - Fireball

@danilang 

 

Sorry to bring up an old post but I'm trying to figure out something very similar.  In your solution it was to see if the OP's times were between 10pm - 6am.  How would you do it for the half hours? 

 

I'm trying to see if times fall in the range of 8:30am - 16:30pm.  Something like the below:

 

[Time_Out2]
16:50:00
11:01:26
22:05:35
21:00:35

 

If [Time_Out2] is between 8:30am - 16:30pm then 1 else 0

 

 

thanks

BonusCup
10 - Fireball

UPDATE: solved


If (DateTimeFormat([Time_Out2],"%H%M") > "0830" &&  
DateTimeFormat([Time_Out2],"%H%M") < "1630")
then 1
else 0
endif

 

Labels