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
Unanswered

Last date of Month

(0) ShareShare
ReportReport
Posted on by

For example I have a Month and Year Feb, 2023. How can i get last date of Feb, 2023 in power automate desktop

I have the same question (0)
  • cwischnewski Profile Picture
    162 on at

    The basic idea you want to use is to get the first of the month as a datetime variable.  You might have to play around with the "Convert text to datetime" to get that right.  Once have the first of the month, you can use "Add to datetime" to add a month, then use that same action to add a negative one day.  It is all in the Time unit parameter you select in each step.

  • Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    You essentially need to convert it to a date time variable first. When you use Convert text to datetime, and provide a custom format without a day, it will by default convert it to the 1st of the month. You then need to use Add to date time twice - once to add one month, and once do deduct the current day, so you end up with the end of the month.

     

    See this sample flow:

    Agnius_0-1703312127424.png

    And note the custom format I used in the Convert text to datetime action:

    Agnius_1-1703312166721.png

     

    Finally, note that this will only work if the language of the name of the month matches the regional settings for your machine. If your machine is set up in a different language, it won't work, and you'll need to implement some sort of a dictionary functionality, or use a Python script.

     

    Here's a code snippet you can copy and paste into your designer to have the actions created for you automatically:

    SET DateAsString TO $'''Feb, 2023'''
    Text.ConvertTextToDateTime.ToDateTimeCustomFormat Text: DateAsString CustomFormat: $'''MMM, yyyy''' DateTime=> TextAsDateTime
    DateTime.Add DateTime: TextAsDateTime TimeToAdd: 1 TimeUnit: DateTime.TimeUnit.Months ResultedDate=> ResultedDate
    DateTime.Add DateTime: ResultedDate TimeToAdd: $'''-%ResultedDate.Day%''' TimeUnit: DateTime.TimeUnit.Days ResultedDate=> EndOfMonth
    

    -------------------------------------------------------------------------
    If I have answered your question, please mark it as the preferred solution. If you like my response, please give it a Thumbs Up.

    I also provide paid consultancy and development services using Power Automate. If you're interested, DM me and we can discuss it.

  • GufranRaheem Profile Picture
    on at

    Thanks Its works.

  • Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    Please accept the reply that answered your question as the solution.

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 241 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 179

#3
Haque Profile Picture

Haque 159

Last 30 days Overall leaderboard