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

Community site session details

Session Id : fqRk38a0C6/HzA6OcxXWdJ
Power Apps - Building Power Apps
Answered

Showing date difference as years, months, days

Like (0) ShareShare
ReportReport
Posted on 1 Sep 2023 11:43:11 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())

  • Chris-D Profile Picture
    1,246 on 04 Sep 2023 at 16:08:42
    Re: Showing date difference as years, months, days

    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 

  • Chwilkinson Profile Picture
    125 on 01 Sep 2023 at 13:48:13
    Re: Showing date difference as years, months, days

    Hi @LaurensM 

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

    Thank you

  • Verified answer
    LaurensM Profile Picture
    12,510 Moderator on 01 Sep 2023 at 13:28:28
    Re: Showing date difference as years, months, days

    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 01 Sep 2023 at 12:31:49
    Re: Showing date difference as years, months, days

    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

  • LaurensM Profile Picture
    12,510 Moderator on 01 Sep 2023 at 11:58:08
    Re: Showing date difference as years, months, days

    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!

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

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 791 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 410 Super User 2025 Season 2

#3
mmbr1606 Profile Picture

mmbr1606 275 Super User 2025 Season 2

Loading complete