cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

validate that a date is not in the range of 2 dates

I need users not to enter a date that is within the range of these fields, as they are used to mark the date of the meeting in a meeting room

Start Date and End Date

The format of these dates is as follows

Example 1 Entry
Start date
January 6, 2020 10:10

Final date
January 6, 2020 10:40


as you can see they have a range of 10:10 to 10:40

I want to validate that they do not save a new date following the previous example

Example 2 Entry
Start date
January 6, 2020 10:25

Final date
January 6, 2020 10:35


as you can see here they would conflict because I have 2 meetings at the same time

These 2 fields are of the selected string type with a date and time selector

for the hour and minutes a combo box is used

10 REPLIES 10
Anonymous
Not applicable

Hi @Anonymous 

It worked correctly, I just had to adapt it to my needs as you explained it to me with DateTimeValue

Look:

 

Set(
DateI,
DateTimeValue (DateStart.SelectedDate & "" & TimeStart.Selected.Value & ":" & MinStart.Selected.Value)
);
Set(
DateF,
DateTimeValue(EndDate.SelectedDate & "" & FinalTime.Selected.Value & ":" & MinEnd.Selected.Value)
);
Clear (MeetingTaken);
For all (
Training,
Yes (
DateI> = DateTimeValue (Start Date) && DateI <= DateTimeValue (End Date) || DateF> = DateTimeValue (Start Date) && DateF <= DateTimeValue (EndDate) || DateI <= DateTimeValue (Start Date) && DateF> = DateTimeValue (End Date),
Collect (
MeetingTaken,
true
)
)
);
If (
First (MeetingTaken) .Value = true,
Notify ("Time of meeting taken"),
Set(
Confirm,
true
)
)

Thank you very much for your help I understood it well

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,148)