cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
EmmaB
New Member

How to have icon visible based on date within next 6 months

Hi

 

I want an icon to show when the date entered into a date picker is within the next 6 months of todays date.

 

How would i do this?

 

Thanks

2 REPLIES 2
Akser
Solution Supplier
Solution Supplier

You can add a formula like the one below to the Visibility option of your icon I guess?

If(DateDiff(DatePicker.SelectedDate, Now()) < 180, true, false)
timl
Super User
Super User

@EmmaB 

Just to extend @Akser's answer which is logically on the correct track, you can just set the Visible property of the icon to this: 

(DateDiff(Now(), DatePicker.SelectedDate) < 180)

Since the expression itself returns true/false, we can omit the call to If.

Also, to test for a target future date, we would set Now() as the first argument to DateDiff. This is because if we were to set the date picker value as the begin date and if the user were to enter a future date, the result would be a negative value in days.

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Top Solution Authors
Top Kudoed Authors
Users online (2,693)