Skip to main content

Notifications

Community site session details

Community site session details

Session Id : kTtvIskS/W0zPufBIZwB9d
Power Automate - Building Flows
Answered

How to add one year to a current date

Like (1) ShareShare
ReportReport
Posted on 12 Jul 2024 18:41:56 by 412

Hello,

 

I have a compose action that gets the current year: formatDateTime(utcNow(), 'yyyy')

 

This works great. What I'm trying to do is use another compose action that adds one year to the year above. So far I have been trying the addtoTime and addDays expressions but have been unsuccessful. 

 

The last one I tried was: addDays(outputs('Compose_5'), 365, 'yyyy')

 

Ultimately, I would like to use these steps to build a condition that says if a folder with the current year does not exist in my SharePoint library, then create a new folder for the new year. So I've created a folder for 2024 but when 2025 arrives and subsequent new years, I would like for the workflow to create the new folder for documents to be populated into. Can anyone help me with any guidance on this?

  • Chriddle Profile Picture
    7,680 Super User 2025 Season 1 on 19 Dec 2024 at 10:40:34
    How to add one year to a current date
    ​​​​​​​getFutureTime(1, 'year''yyyy')

    addToTime(utcNow(), 1, 'year', 'yyyy')

    add(int(utcNow('yyyy')), 1)
  • AM-03091305-0 Profile Picture
    31 on 19 Dec 2024 at 10:13:42
    How to add one year to a current date
    Please note that the proposed expression of formatDateTime(addDays(utcNow(),365),'yyyy') will not account for leap years. For example, on January 1, 2024, the expression to add 365 days will return "2024" coming from December 31, 2024. To account for this, you can check if the adding of 365 still results in the same year as the current utcNow year using the following expression:
     
    if(equals(formatDateTime(addDays(utcNow(),365),'yyyy'),formatDateTime(utcNow(),'yyyy')),formatDateTime(addDays(utcNow(),366),'yyyy'),formatDateTime(addDays(utcNow(),365),'yyyy'))
  • MN003 Profile Picture
    412 on 12 Jul 2024 at 21:37:12
    Re: How to add one year to a current date

    @creativeopinion, this worked perfectly. Thank you! Also, thanks for the helpful YT tutorial link. I'll check that out.

  • Verified answer
    creativeopinion Profile Picture
    10,396 Super User 2025 Season 1 on 12 Jul 2024 at 19:56:13
    Re: How to add one year to a current date

    @MN003 

     

    You can use a single expression:

    formatDateTime(addDays(utcNow(),365),'yyyy')

     

    You might be interested in this YT Tutorial: How to Work with đ꓆ Dates in Power Automate | Example Scenarios and Tips & Tricks

     

    Are you easily stumped when working with Dates in Power Automate? In this Power Automate tutorial, I’ll show you how to compose an expression that will return a future date, a past date, how to count the number of days between two dates, how to check for a birthdate and anniversary date as well as tips and tricks when working with dates in Power Automate.

     

    I’ll cover some common use cases and concepts that can help you to build better Power Automate flows. Feel free to skip ahead using the timestamps listed below. I’ve also linked a few other tutorials that you might be interested in as well.

    IN THIS VIDEO:

    âś… 4 Date Functions You Need to Know

    âś… How to use the Convert Time Zone Action

    âś… How to Get a Future Date

    âś… How to Get a Past Date

    âś… How to Return SharePoint Items Due in a Number of Days

    âś… How to Return SharePoint Items Due within a Date Range

    âś… How to write a Filter Query for SharePoint Items Due in 30, 60 and 90 Days

    âś… How to Calculate the Number of Days between Two Dates

    âś… How to Check for a Birthdate and Anniversary Date

    âś… How to work with Dates and Times in Excel

    âś… How to use a Manual Trigger with Date Input

    âś… How to Output Dynamic Text with an Expression

    âś… How to Check if a Date Falls on a Weekend

     

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,670 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,013 Most Valuable Professional

Leaderboard
Loading started
Loading complete