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 Automate / calculate years from j...
Power Automate
Answered

calculate years from joining date

(0) ShareShare
ReportReport
Posted on by 997 Super User 2024 Season 1

Hi, I'm trying to get Year of Service based on the Joining Date of an employee. I followed a youtube video and managed to get the total days from the joining date until the present day. I want years instead of days. How to do that? Do I need to divide days into months then years? 

anonymous21_0-1655445224147.png this is my flow to get the total days

 

Thank you.

 

Categories:
I have the same question (0)
  • Verified answer
    Expiscornovus Profile Picture
    33,801 Most Valuable Professional on at

    Hi @syhrh,


    You could convert the present day and the joiner day to ticks and calculate the difference by using a sub function. You can div the result by 315,360,000,000,000 which is the amount of ticks in a non-leap year:

    https://docs.microsoft.com/en-us/dotnet/api/system.datetimeoffset.addticks?view=net-6.0#remarks

     

    Below is an example of that approach.

     

    1. A SharePoint list with a Joiner Date column

     

    joiner_calc.png

     

    2. The flow with a Get Items and a Select action.

     

    The Years working key uses the following expression as a value:

    div(sub(ticks(utcNow()), ticks(item()?['JoinerDate'])), 315360000000000)

     

    subticks_convertonormalyear.png

     

    The output will look like below.

     

    output_numberofyears.png

  • syhrh Profile Picture
    997 Super User 2024 Season 1 on at

    @Expiscornovus It works, thank you!

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 304

#2
David_MA Profile Picture

David_MA 245 Super User 2026 Season 1

#3
Expiscornovus Profile Picture

Expiscornovus 243 Most Valuable Professional

Last 30 days Overall leaderboard