web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / check if datetime over...
Power Apps
Unanswered

check if datetime overlaps with list of datetimes

(0) ShareShare
ReportReport
Posted on by 9

I have a DateTime and a numerical duration (in minutes) that we can call selectedDateTime and seletedDuration respectively.

I also have a sharepoint list called 'Room Bookings' where each item has a DateTime and an associated duration.

 

How can I check if the selected timeslot overlaps with one of the timeslots already in the list and return a boolean?

 

ex:

selectedDateTime 'Room Bookings'.dateTime'Room Bookings'.duration
2024-06-27 12AM2024-06-27 12AM60
seletedDuration 2024-06-27 12PM90
1202024-06-27 1AM240
Categories:
I have the same question (0)
  • Verified answer
    v-jefferni Profile Picture
    on at

    Hi @AgentMatthew ,

     

    To filter a data source on the condition of time NOT overlapping, the condition is selected start time >= end time OR selected end time <= start time. So, for your requirement, you need to use below formula:

    !IsBlank(LookUp('Room Bookings', !(selectedDateTime >= DateAdd(dateTime, duration, TimeUnit.Minutes) || DateAdd(selectedDateTime, selectedDuration, TimeUnit.Minutes) <= dateTime)))

     

    If the formula returns true, it means there is one or more entries in the list has dateTime overlapping with the selected duration.

     

    Best regards,

  • MatthewBurton Profile Picture
    9 on at

    that works a treat! thank you so much 🙏🙏

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard