web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Getting string from cr...
Power Automate
Unanswered

Getting string from created date

(0) ShareShare
ReportReport
Posted on by

I'm prefixing all uploaded docs in a library with the ID using an HTTP request. This all works.

What I need to do is extract the date from the created column. I want the output to look like 0520 (for May 2020).

 

I've experimented with variables, compose but I am thinking I may have to convert the created date to a timestamp then substring the correct numbers. Will need help with that!

 

Regards,

C

Categories:
I have the same question (0)
  • abm abm Profile Picture
    32,865 Most Valuable Professional on at

    Hi @Anonymous 

     

    Use the expression formatDateTime. See below.

     

    formatDateTime(items('Apply_to_each')?['Created'],'MMdd')
     
    Here I am iterating the created datetime in a loop and formats with month and date.
     
    Another example using todays date. 
    formatDateTime(utcNow(),'MMdd')
     
    Thanks
     
  • Community Power Platform Member Profile Picture
    on at

    Hi abm,

     

    If I wanted to do just the one uploaded document, I don't need the Apply to Each do I?

     

    C

  • abm abm Profile Picture
    32,865 Most Valuable Professional on at

    Hi @Anonymous 

     

    Thanks for your reply. So after the upload are you trying to rename the filename? Could you please post a screenshot of your flow?

     

    Thanks

  • Community Power Platform Member Profile Picture
    on at


    Yes - just after a document is uploaded, I'm renaming it. I want to add the created date to that rename along with the ID. All I need to know is how to do the created date as:

     

    0520

     

    This would be May 2020.

     

    The flow:

    1.PNG

  • abm abm Profile Picture
    32,865 Most Valuable Professional on at

    Hi @Anonymous 

     

    Thanks for the screen shot. 

     

    Add a compose action before your http request. Under the compose use the formatDateTime against the created date. Then pass the output to next HTTP step.

     

    Thanks

     

     

  • abm abm Profile Picture
    32,865 Most Valuable Professional on at

    Hi @Anonymous 

     

    Try this expression

     

    formatDateTime(triggerOutputs()?['body/Created'],'MMdd')
     
    You could use this expression directly in your HTTP without the Compose action.
     
    Thanks
  • Verified answer
    v-alzhan-msft Profile Picture
    on at

    Hi @Anonymous ,

     

    The expression for the date should as below:

    formatdatetime(triggerBody()?['Created'],'MMyy')

     

    Refer to screenshot below:

    1.png2.png

     

    Best Regards,

    Alice

     

    Community Support Team _ Alice Zhang
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • abm abm Profile Picture
    32,865 Most Valuable Professional on at

    Hi @Anonymous 

     

    It's my bad yes the format you need is 'MMyy'

     

    Thanks

  • Community Power Platform Member Profile Picture
    on at

    Why use TriggerBody() ?

     

  • abm abm Profile Picture
    32,865 Most Valuable Professional on at

    Hi @Anonymous 

     

    Your trigger already have that info. 

     

    Thanks

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard