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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Showing date differenc...
Power Apps
Answered

Showing date difference as years, months, days

(0) ShareShare
ReportReport
Posted on by 125

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())

Categories:
I have the same question (0)
  • LaurensM Profile Picture
    12,516 Moderator on at

    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!

  • Chwilkinson Profile Picture
    125 on at

    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

  • Verified answer
    LaurensM Profile Picture
    12,516 Moderator on at

    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!

  • Chwilkinson Profile Picture
    125 on at

    Hi @LaurensM 

    Yes that looks like its going to give me the result I need

    Thank you

  • Chris-D Profile Picture
    1,246 on at

    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. 

     

    My Solution 

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 711 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 319 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard