Hi PowerApps community,
I'm trying to show the time in role in a PowerApps from the users start date
I'm using the datediff function but not sure how to convert it to show, years, months and days in role.
Any suggestions on how to convert the total days into years, months and days?
Thanks
DateDiff(ThisItem.'Start Date', Today())
Hi @Chwilkinson ,
This question comes up a lot. The answer and solution posted on the page that Google always finds, and other people link to, can be wildly inaccurate.
I've had a lot of fun working on a better solution and have posted it on that page.
Thank you for the additional info @Chwilkinson.
The following topic displays a possible solution to that requirement, which would also have been my first approach. Now that being said, it may not provide the perfect accuracy that you need in your case which is also further explained in there.
I hope this helps!
Thanks @LaurensM for the speedy reply,
What I'm looking to show is Time in role
My current calculation shows in days
Example
Time in role,
DateDiff(ThisItem.'Start Date', Today()) = 4225 (days)
What I'd like show is a combination of years, months and days.
Time in role
11 years 6 months 26 days
Thanks,
Chris
Hi @Chwilkinson,
DateDiff has a 3rd optional parameter to define the unit (see documentation)
//Year
DateDiff(ThisItem.'Start Date', Today(), TimeUnit.Years)
//Month
DateDiff(ThisItem.'Start Date', Today(),TimeUnit.Months)
//Days (default)
DateDiff(ThisItem.'Start Date', Today())
If this solves your question, would you be so kind as to accept it as a solution & give it a thumbs up.
Thanks!
WarrenBelz
791
Most Valuable Professional
MS.Ragavendar
410
Super User 2025 Season 2
mmbr1606
275
Super User 2025 Season 2