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 Platform Community / Forums / Power Automate / Add time stamp to file...
Power Automate
Answered

Add time stamp to file name

(0) ShareShare
ReportReport
Posted on by 109

Having looked through the community, I think this is a really obvious bit of knowledge which I don't have and which highlights my ignorance!! 🙈

I've created a flow that saves attachments with specific words in the name to OneDrive. I'd like them to save with a unique identifier, eg the date. How do I do that?! 😁

 

scrn.jpg

Categories:
I have the same question (0)
  • Verified answer
    Ed Gonzales Profile Picture
    4,531 Most Valuable Professional on at

    @Magikmissy 

    Hi there.  So, there are a few ways to do this...this way uses the least amount of 'functions' and I'll be really detailed so I don't miss covering something you might want:

     

    First thing would be to add the step "Current Time".  This will grab the current date/time in a long format like this: 2020-01-16T15:43:22.9817623Z   - Note that this won't be in your local timezone unless you sit right in UTC or GMT.  We can fix the timezone and ugly formatting in the next step.

     

    Next, add the step "Convert time zone" and use the output from your 'current time' step as the 'Base time'.  Select UTC as the source time, and then your local timezone as the destination timezone.  If you want to keep everything in UTC (if you're working internationally, as an example), then just set the destination to UTC also.

     

    In the format part, you can choose from the list, but none of those will work great as file names, so the best bet will be to go to the bottom of the list an select "Enter custom value" and then type in your own format.  I used yyyyMMdd_hhmm which is the four digit year, followed by the 2 digit month (note the caps), then a 2 digit date, an underscore and then the time.  Here's what it all looks like:

     

    20200116b.PNG

     

    At the end, I used a "Compose" to store the information, and then you can drop that into the rest of your filename (maybe...depending on where/how you're storing the file).  The output looks like this:     20200116_0743

     

    Hope that helps.  Keep us posted.

    -Ed-

     

    If you liked this reply, please give it a thumbs up! If this reply has answered your question or resolved your challenge, please consider marking it as a Solution. This helps other users find it more easily via search.

  • Magikmissy Profile Picture
    109 on at

    Thank you so much @edgonzales! I'm going to try it now, but just quickly... whereabouts in the process do I insert it?! (Sorry, I really am a newbie!)

    Also, I'm English and on GMT so can I skip that step? How does that work?  

    😍

  • Ed Gonzales Profile Picture
    4,531 Most Valuable Professional on at

    You can put this anywhere as long as it is before the step where you're saving the file.  It's independent of pretty much anything.

    If you're comfortable with expressions, you can replace everything with a single Compose and this expression: 

    formatDateTime(utcNow(),'yyyyMMdd_hhmm')
     
    If you're not comfortable with those (yet 😉), then I'd suggest keeping the "Convert time zone" step with the same source and destination, and basically use that step just to get the date format you want.
     
    Let us know how that works out.
    -Ed-
     

    If you liked this reply, please give it a thumbs up! If this reply has answered your question or resolved your challenge, please consider marking it as a Solution. This helps other users find it more easily via search.

  • Magikmissy Profile Picture
    109 on at

    Great, thanks! (I love the faith you have in me... 'yet'...!!!) How about the UK thing? 

  • Ed Gonzales Profile Picture
    4,531 Most Valuable Professional on at

    It's a slippery slope and I think we all inevitably will glide down to some degree.  I'm working on a series that will make expressions less scary for 'non-developers' or 'code-averse' folks like myself.  Here's a link to my channel, but it won't launch officially until next month.

     

    On the UK thing, that's up to you.  If you're ok with the long format of the date, then you can still the Convert time zone step.  If you want anything different, then I typically use that as an easy way to format the date.  Just leave the source and destination time zones the same, it won't do any math and will just put the date in a format you like.

     

    Good luck!

    -Ed-

     

     

    If you liked this reply, please give it a thumbs up! If this reply has answered your question or resolved your challenge, please consider marking it as a Solution. This helps other users find it more easily via search.

  • Magikmissy Profile Picture
    109 on at

    You're a star, thank you so much!! 😍

  • Magikmissy Profile Picture
    109 on at

    I'm sorry @edgonzales, I think I must have done something wrong! It's functioning with no errors but still saves as just the file name with no date. Where have I goofed up? 

     

    scrn.jpg

  • Ed Gonzales Profile Picture
    4,531 Most Valuable Professional on at

    No problem at all.

    In your Create File step for One Drive, under file name, you'll want to add the output from your Compose, right?

     

    You could also add in a separator like an underscore or something if you want.  So it would look like:

    • Folder path:  /Risk Assessment
    • File Name: <Dynamic Value for Attachments Name>_<Dynamic output from Compose>
    • File Content: <Dynamic Value for Attachments Content>

     

    Does that help?

    -Ed-

  • Magikmissy Profile Picture
    109 on at

    @edgonzales Like this? 

     

    scrn.jpg

  • Ed Gonzales Profile Picture
    4,531 Most Valuable Professional on at

    Perfect.  sort of.  I just thought of something: The filename extension is getting in the way.  So, if the filename is risk assessment.jpg, the thing you and I built will try to name the file risk assessment.jpg20200116_0824

     

    we'll have to do some stuff to make it risk assessment 20200116_0824.jpg, but it will actually use the stuff in my one and only video 🙂

     

    I'll build something real quick to demonstrate.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 557

#2
Valantis Profile Picture

Valantis 328

#3
David_MA Profile Picture

David_MA 264 Super User 2026 Season 1

Last 30 days Overall leaderboard