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 Automate
Answered

Date Calculations

(0) ShareShare
ReportReport
Posted on by 297

I am new to Power Automate so I am playing with simple little things just to get a feel for this.

See the screenshot of my flow as it is now.

Daily Schedule: it runs once a day in the morning - no problem there.

Get Client Information - data is in dataverse.

Today: formatDateTime(utcNow(),'MM-dd')

Condition: checks if DOB column contains the MM-dd.

If true, sends a email to the customer service manager.

 

It works! Now, I want to improve the email by giving the age of the client.

 

Here is what I THINK should happen - please tell me if this will work.

I have to create a variable for the current year, another variable for the birth year, and do a calculation to determine the age. 

If I am right, please give me some guidance on how to make it happen.

Screenshot 2023-08-31 131307.png
Categories:
I have the same question (0)
  • efialttes Profile Picture
    14,756 on at

    @hildasteyn 

    If it's enough for you to substract years, you can get current year by means of the following WDL expression

     

    int(formatDateTime(utcNow(),'yyyy'))

     

    ...follow the same procedure to transform birthday into year of type int...

     

    int(formatDateTime(<birhthday date here in ISO 8601 format>,'yyyy'))

     

    ...and finally use WDL function sub() to do the math:

     

    sub(int(formatDateTime(utcNow(),'yyyy')),int(formatDateTime(<birthday in iso 8601 format here>,'yyyy')))

     

     

    Or, if you wanna be a bit more precise, I guess you can substract birthday from current date. If so, please have a look to Tom Riha's blog here on how to calculate difference between two date time strings by means of ticks difference:
    https://tomriha.com/how-to-calculate-difference-between-two-times-in-power-automate/
    Hope this helps!

  • Verified answer
    Linn Zaw Win Profile Picture
    2,996 on at

    @hildasteyn 

    Since you are only picking the records with the same day and month, you can simply calculate the age by subtracting the year of the DOB from the current year.

    Here's the expression for it and you just have to replace the logical name of the DOB column in the following one.

    sub
    (
     int(formatDateTime(utcNow(), 'yyyy')),
     int(formatDateTime(items('Apply_to_each')?['xyz_dob'], 'yyyy'))
    )

     

     

  • Hilda Steyn Profile Picture
    297 on at

    Okay you are my hero for the day! Thank you so much!

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

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 267 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 196

#3
Haque Profile Picture

Haque 182

Last 30 days Overall leaderboard