479
Views
5
Comments
Solved
How to compare times ?
Question

Hi !

I want to check if time is between two times like #00:00:00#< time < #08:00:00#, I tried to do this but it throws an error that "Cannot apply Boolean together with Time"

How do I check if a time falls between a time range ? 

Thanks !


--> EDIT:
I am not looking for difference I am clearly asking how to check if a time falls within a range like between two times

2025-04-17 05-42-16
Ajit Kurane
Solution

Hello Shahan,

you can use like this,

#00:00:00# < Time and Time < #08:00:00#

Please try this and let me know.

Regards,

Ajit Kurane.

UserImage.jpg
Shahan Alam

thanks it works, I thought time<TIME<time would work but sadly it doesnt need to have an and  in between

2025-04-17 05-42-16
Ajit Kurane
2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

The reason why time < TIME < time doesn't work in OutSystems and, afaik, most programming languages, is that "time < TIME" results in a boolean value (True or False), which can't be compared to the second "time".

UserImage.jpg
Ellakkiya

Hi Shahan Alam,

I have attached the some similar thread, that might help you
https://www.outsystems.com/forums/discussion/64972/different-between-two-times/

https://www.outsystems.com/forums/discussion/62808/time-difference-function/

Please gothrough the below document

https://success.outsystems.com/Documentation/11/Reference/OutSystems_Language/Logic/Built-in_Functions/Date_and_Time

you can use the DiffHours(DateTime, DateTime) ,DiffMinutes(DateTime, DateTime) as per your use case

Hope this helps!

Regards,

Ellakkiya.S

2025-04-17 05-42-16
Ajit Kurane
Solution

Hello Shahan,

you can use like this,

#00:00:00# < Time and Time < #08:00:00#

Please try this and let me know.

Regards,

Ajit Kurane.

UserImage.jpg
Shahan Alam

thanks it works, I thought time<TIME<time would work but sadly it doesnt need to have an and  in between

2025-04-17 05-42-16
Ajit Kurane
2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

The reason why time < TIME < time doesn't work in OutSystems and, afaik, most programming languages, is that "time < TIME" results in a boolean value (True or False), which can't be compared to the second "time".

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.