How to check Time if it Falls in a Certain Range
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
I want to check if those times falls inside 10PM - 6AM.
Please Help,
Thanks!
Solved! Go to Solution.
- Labels:
- Date Time
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Check the data type. And the use datetime parse and formula tools to achieve.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
UPDATE: solved
If (DateTimeFormat([Time_Out2],"%H%M") > "0830" &&
DateTimeFormat([Time_Out2],"%H%M") < "1630")
then 1
else 0
endif
