How to pass previous year in the expression

Vijay 131 Reputation points
2023-01-04T07:37:38.973+00:00

In my work area they follow the SharePoint files like(previous month and present month) so the problem is if present month files is jan 2023 it will pick fine but previous month file is dec 2022 insted the logic app will pick dec 2023
If present month is Feb then previous month is jan it fine because both are in same years

Can you please provide the solution for this case

Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
1,831 questions
No comments
{count} votes

Accepted answer
  1. MayankBargali-MSFT 49,961 Reputation points
    2023-01-04T09:22:56.853+00:00

    @Vijay Thanks for reaching out. You can leverage the below function expression. You can refer to Date and Time function .

    formatDateTime(addDays(startOfMonth(utcNow()),-1),'MMMyyyy')  
    

    As today date is 4th Jan 2023 the output of the above expression is Dec2022

    Please 'Accept as answer' and ‘Upvote’ if it helped so that it can help others in the community looking for help on similar topics.


0 additional answers

Sort by: Most helpful