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 / Calculating "Last day ...
Power Apps
Unanswered

Calculating "Last day of current month" gets different result in Chrome vs Teams/Edge

(0) ShareShare
ReportReport
Posted on by 18

I found this very helpful function for calculating last day of current month in some forum som time ago:
Set(varLastDayOfMonth, "" & Month(Today()) & "" & "/" & "" & Day(DateAdd(DateAdd(Today(),1,TimeUnit.Months),-Day(Today()),TimeUnit.Days)) & "" & "/" & "" & Year(Today()) & "");

 

This has been working great when my PowerApp is executed in Chrome.

However, now I have to share it in Teams, and then the function calculates wrong date...

Instead of show 03/31/2023 it says 07/03/20225... Same thing in Edge. Why??

 

Regards,

John Martin

 

Categories:
  • victorcp Profile Picture
    2,350 Moderator on at

    Hi,

    I don't know why it is not working, but I would suggest try another way of doing the same, like this:

    Set(
     varLastDayOfMonth, 
     Text(
     DateAdd(
     Date(Year(Today()),Month(Today())+1,1), /*First day of next month and then get the previous day*/
     -1,
     TimeUnit.Days
     ),
     "mm/dd/yyyy" /*format the text*/ 
     )
    )

     

    I hope it helps 🙂

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 221 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 188 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 120

Last 30 days Overall leaderboard