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

check if the date is before or after two weeks from the current week

Hi, 

 

I'll be creating a validation wherein I need to check if the date is before or after two weeks from the current week. 

Just wondering if there's available function that I can utilize for this requirement. 

 

Thank you in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
ArchitectMadhan
Power Participant
Power Participant

Hi @Anonymous ,

 

I have used the formula If((Self.SelectedDate>(Today()-14) && Self.SelectedDate<(Today()+14)),Self.SelectedDate,"Select valid date") to show the warning notification on selection of date in the date picker. You have to use the same formula in both OnSelect and OnChange. Apart from this I have also set the Start Year and End Year in advanced properties of date picker to 2021. So that user can see only the current year calendar.

ArchitectMadhan_1-1626779867934.png

 

If you find my solution helpful for resolving the issue, then please consider Accept it as the solution to help the other members find it more quickly.

- Architect Madhan

Please click the "Accept as Solution" button and give thumbs up, if it is helpful to you.

View solution in original post

4 REPLIES 4
KvB1
Solution Sage
Solution Sage

You can just compare the date of a record to Today()+14 using If(

This does require that the column is a date argument, if its Text you'd have to convert it to a Date first.

Or is this not what you need?

JamesYumnam
Resolver III
Resolver III

@Anonymous  in addition to Kvb1's answer which compare your date in your record to Today's date, if you want to actually compare out with respect to the current week. then you can use Weekday function. with this, find out the current week's start and end date first. then if you want to compare before, use the start date of the current week minus (-) 14, and if you want to compare after, use the end date of the week plus (+) 14.

ArchitectMadhan
Power Participant
Power Participant

Hi @Anonymous ,

 

I have used the formula If((Self.SelectedDate>(Today()-14) && Self.SelectedDate<(Today()+14)),Self.SelectedDate,"Select valid date") to show the warning notification on selection of date in the date picker. You have to use the same formula in both OnSelect and OnChange. Apart from this I have also set the Start Year and End Year in advanced properties of date picker to 2021. So that user can see only the current year calendar.

ArchitectMadhan_1-1626779867934.png

 

If you find my solution helpful for resolving the issue, then please consider Accept it as the solution to help the other members find it more quickly.

- Architect Madhan

Please click the "Accept as Solution" button and give thumbs up, if it is helpful to you.
Anonymous
Not applicable

Thanks so much... This helped!!!

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,207)