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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Comparing Month and Da...
Power Apps
Unanswered

Comparing Month and Day Between Two Dates

(0) ShareShare
ReportReport
Posted on by 17

I am building an app that details our payroll changes using a Sharepoint List. One of the things my employer does is give everyone an admin day for their birthday, BUT to get the admin day for your birthday, the day & month of your birthday has to be before the day & month of your hire date.

 

Currently, I have a gallery detailing the details of the employee. I thought it would be kind of cool to add a cake emoji next to the employees in the gallery who get an admin day. I understand how to add the emoji, but I am not sure how to compare the dates.

 

The dates in the gallery are formatted dd/mm/yyyy,  but I only need to compare the day and months of the two dates.

 

For example:

 

Name                       Hire Date               DOB

Employee A  🎂       05/06/2022          01/08/1980

Employee B             02/14/2022          02/01/1992

Employee C   🎂      03/25/2022          11/19/1990

 

In the example, Employee A and Employee C would both get the admin day because the day & month of their birthday is less than the day & month of their hire date. 

 

How would I do this?

 

Thanks! 

Categories:
I have the same question (0)
  • timl Profile Picture
    37,283 Super User 2026 Season 2 on at

    @ConwayHR 

    A possible way to do this is to set the Items property of your gallary to include 2 extra columns - HireDate2 and DOB2.

    AddColumns(YourList,
     "HireDate2",
     Date(Year(Now()), Month(HireDate), Day(HireDate)),
     "DOB2",
     Date(Year(Now()), Month(DOB), Day(DOB))
    )

     

    The values in these columns would include the day and month of the hire date and DOB fields respectively, but all the year values would be set to the current year.

    Once you do this, you can set the visible property of your cake icon to the following expression:

     

    (ThisItem.DOB2 < ThisItem.HireDate2)

     

  • ConwayHR Profile Picture
    17 on at

    .

  • ConwayHR Profile Picture
    17 on at

    Can I add columns to the gallery since I have it filtered? Also, the dates are showing times, so I changed them to Text(ThisItem.'Hire Date',"mm/dd/yyyy"), would this still work?

     

    Thank you so much for your help! 

  • timl Profile Picture
    37,283 Super User 2026 Season 2 on at

    Hi @ConwayHR 

    Sure, it would work with a filtered gallery. The syntax would look like this:

    AddColumns(Filter(YourList,<Your Filter Expression>),
     "HireDate2",
     Date(Year(Now()), Month(HireDate), Day(HireDate)),
     "DOB2",
     Date(Year(Now()), Month(DOB), Day(DOB))
    )

    For labels within the gallery, it'll still be fine to format those using the Text function, as you're currently doing.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 329 Most Valuable Professional

#2
11manish Profile Picture

11manish 209 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 179

Last 30 days Overall leaderboard