cancel
Showing results for 
Search instead for 
Did you mean: 

Data Operations – Compose: Format Date and Time

What is the definition of Compose action with Microsoft Flow?

Use the Data Operations – Compose action to save yourself from entering identical data multiple times when you’re designing a flow. What does this mean in practice? You can shape the data that has been generated by an above action, by using an expression or adding data that you want to use several times in your flow.

In this example, I will explain the expression Date and Time, with an example of each date and time expression.

 

The flow what is it doing?

The flow that I will use to demonstrate some of the date and time expressions has the following actions and connectors:

  • Outlook – When a new email arrives
  • Data Operations – Compose
  • SharePoint – Create file

The flow will be triggered by an email that has been send to an inbox from a certain sender and with an attachment and subject “SharePoint”. When the flow has been triggered, we will create a date and time format that will be attached to the file name on creation in the SharePoint document library.

Flow overview:

Flow02-02.pngHigh level view of the flowFlow02-01.png

I will explain here a view of them:

Expression: formatDateTime(timestamp,format)

Returns a string in date format

Expression string:

StringformatDateTime(triggerBody()?['DateTimeReceived'],'yyyyMMdd')
Result20180930_Flow_Test_File.txt

This expression will get “Date Time Received” from the email and format will be change to yyyyMMdd and attached to the new file name that will be create in SharePoint.

With:

yyyy = year (example: 2018)
MM = month (example: 08)
dd = day (example: 11)

Expression: utcNow()

Returns the current Coordinated Universal Time timestamp as a string

Expression string:

StringutcNow()utcNow(‘yyyy’)
Result2018-09-30T20_15_18.0324638Z_Flow_Test_File.txt2018_Flow_Test_File.txt
StringutcNow(‘dd’)utcNow(‘MM’)
Result30_Flow_Test_File.txt09_Flow_Test_File.txt
StringutcNow(T’)utcNow(‘t’)
Result8_35_16 PM_Flow_Test_File.txt8_36 PM_Flow_Test_File.txt

Combination is also possible with the formatDateTime – expression an example:

StringformatDateTime(utcNow(),’yyyy-MM-dd’)
Result20181001_Flow_Test_File.txt

Expression: GetFutureTime(interval,TimeUnit,Format?)

Returns a timestamp that is the current time plus the specified time interval.

Interval need to be an integer and the time unit: "Second", "Minute", "Hour", "Day", "Week", "Month", "Year"

Expression string:

StringgetFutureTime(5,'Hour','yyyy-MM-ddThh:mm:ss')
Result2018-10-01T02:52:25_Flow_Test_File.txt

More information about Date and Time formatting can be found it's LINK

I hope you have found the usefully to add some date and time formats to your Microsoft Flow.

Flow02-04.png

REMARK

String need to be entered by using the expression selection. I had already the experience when typing the text manually it’s not accepting the content. So select the expression and add them automatically in the Compose field to edit as appropriate.

Flow02-03.png

 

Meet Our Blog Authors
  • Experienced Consultant with a demonstrated history of working in the information technology and services industry. Skilled in Office 365, Azure, SharePoint Online, PowerShell, Nintex, K2, SharePoint Designer workflow automation, PowerApps, Microsoft Flow, PowerShell, Active Directory, Operating Systems, Networking, and JavaScript. Strong consulting professional with a Bachelor of Engineering (B.E.) focused in Information Technology from Mumbai University.
  • I am a Microsoft Business Applications MVP and a Senior Manager at EY. I am a technology enthusiast and problem solver. I work/speak/blog/Vlog on Microsoft technology, including Office 365, Power Apps, Power Automate, SharePoint, and Teams Etc. I am helping global clients on Power Platform adoption and empowering them with Power Platform possibilities, capabilities, and easiness. I am a leader of the Houston Power Platform User Group and Power Automate community superuser. I love traveling , exploring new places, and meeting people from different cultures.
  • MCT | SharePoint, Microsoft 365 and Power Platform Consultant | Contributor on SharePoint StackExchange, TechCommunity
  • Encodian Owner / Founder - Ex Microsoft Consulting Services - Architect / Developer - 20 years in SharePoint - PowerPlatform Fan
  • I am the Owner/Principal Architect at Don't Pa..Panic Consulting. I've been working in the information technology industry for over 30 years, and have played key roles in several enterprise SharePoint architectural design review, Intranet deployment, application development, and migration projects. I've been a Microsoft Most Valuable Professional (MVP) 12 consecutive years and am also a Microsoft Certified SharePoint Masters (MCSM) since 2013.
  • Big fan of Power Platform technologies and implemented many solutions.
  • Passionate #Programmer #SharePoint #SPFx #Office365 #MSFlow | C-sharpCorner MVP | SharePoint StackOverflow, Github, PnP contributor
  • Web site – https://kamdaryash.wordpress.com Youtube channel - https://www.youtube.com/channel/UCM149rFkLNgerSvgDVeYTZQ/