cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
suyog26
Frequent Visitor

Power flow

I have created a flow in which I am fetching data from cosmos db in which dates are present. but in cosmos the date is formatted as an integer, and at the automated mail which is created using flow it gives date as an integer; How to convert that integer number to MM/dd/yyyy format, so that at the end of my flow the date should be in its proper format.

 

in simple words; want to know how to convert Integer to Date(mm/dd/yyyy)

2 ACCEPTED SOLUTIONS

Accepted Solutions
ccc333ab
Solution Sage
Solution Sage

Try the following in an expression: 

 

addDays('1899-12-30', int(YOURDATE), 'MM/dd/yyyy')

Replacing YOURDATE with the appropriate item from your flow (variable/item/compose output...).

View solution in original post

ccc333ab
Solution Sage
Solution Sage

I assume the date in Compose_2 (red below) 

 

ccc333ab_0-1626708984423.png

 

Will you only ever get 1 date from this loop? Otherwise you'll have a list of dates coming from this loop, and which date is it that you want to post into your email.

 

But I'll assume that there will only have one date coming from this loop, and then you can use this expression in your email: 

 

outputs('Compose_2')[0]

 

 

I.e., 

ccc333ab_1-1626710040329.png

Note: The [0] means return the first item in this list (starts from zero). 

View solution in original post

8 REPLIES 8
ccc333ab
Solution Sage
Solution Sage

Try the following in an expression: 

 

addDays('1899-12-30', int(YOURDATE), 'MM/dd/yyyy')

Replacing YOURDATE with the appropriate item from your flow (variable/item/compose output...).

View solution in original post

suyog26
Frequent Visitor

Thank you for responding but it is giving some random junk values, Can you please help me with this.

 

ccc333ab
Solution Sage
Solution Sage

Can you show me both: 

 

1. A screenshot of the action you are trying to accomplish, including this expression and how you wrote it.

2. A screenshot of the output after you run it

suyog26
Frequent Visitor

Thank you for your help, it is working now. Just need one small help, I want to use that output in an email template, how to use the Output of Apply to each action to an email template. It is giving me the below error

 

Flow save failed with code 'InvalidTemplate' and message 'The template validation failed: 'The inputs of template action 'Send_an_email_from_a_shared_mailbox_(V2)_6' at line '1 and column '24918' is invalid. Action 'Apply_to_each' must be a parent 'foreach' scope of action 'Send_an_email_from_a_shared_mailbox_(V2)_6' to be referenced by 'repeatItems' or 'items' functions.'.'.

 

ccc333ab
Solution Sage
Solution Sage

It would be helpful for any troubleshooting to see a screenshot of your flow.

 

Sounds like you are trying to access your output from outside the "Apply_to_each" loop, you need to access this information inside the loop. But not sure as I have no idea what your loop/flow is doing. 

suyog26
Frequent Visitor

This is how I did that one and it is working.

 

suyog26_1-1626706319962.png

The below one is my flow and in the last step it takes data from all the steps and sends an email accordingly. so i want to fetch that date as well.

suyog26_4-1626708619872.png

 

I want to use the output of Apply to each on the second frame.

suyog26_3-1626708407248.png

 

 

ccc333ab
Solution Sage
Solution Sage

I assume the date in Compose_2 (red below) 

 

ccc333ab_0-1626708984423.png

 

Will you only ever get 1 date from this loop? Otherwise you'll have a list of dates coming from this loop, and which date is it that you want to post into your email.

 

But I'll assume that there will only have one date coming from this loop, and then you can use this expression in your email: 

 

outputs('Compose_2')[0]

 

 

I.e., 

ccc333ab_1-1626710040329.png

Note: The [0] means return the first item in this list (starts from zero). 

View solution in original post

suyog26
Frequent Visitor

Thank you so much for your help. My flow is perfectly working now. It is fetching the right date and format!!

Thanks a lot!!

 

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Top Solution Authors
Users online (3,996)