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

Manipulating Flow Excel Date

Hello,

 

I have an excel table that I want to use to populate a Journal through flow.

 

The excel table looks like this: The column is formatted to the Date Format:

Flow Pic 1.png

 

When Flow Picks up the table (List Rows Present in a Table Action) it is reading this date as a String:

Flow Pic 2.png

 

I have tried all sorts of conversions that I can think of but it just doesn't like my string! Does anyone have any idea how I can convert the 43710 to dd/MM/yyyy?

 

Thankyou fo

1 ACCEPTED SOLUTION

Accepted Solutions
manuelstgomes
Super User II
Super User II

Hi @PowerAppUser87 

 

Excel stores internally the dates as sequential serial numbers starting from January 1, 1900, to enable calculations. 

 

So you need to define a date for January 1, 1900, and add the value returned by Excel. Notice that that value is serial number 1 so you need to take two days in the final calculation. Why 2? The first is because the count starts at one and not zero, so you need to take that number off; otherwise, you'll. The other one is a little bit more tricky. For some reason, if you only subtract one, it will display the next day. 

 

Here's a structure of steps.. You can do them all in the "compose" action with formula, but I wanted to show each step.

 

small-Screenshot 2019-09-20 at 09.09.42.png

 

First, the date is a string, so we need to convert it into an int.

 

 

int(body('Get_a_row')?['Date'])

Then take the two days off

 

 

And finally, add the days.

 

addDays('01/01/1900',variables('Date'),'dd/MM/yyyy')

 

 

With this, you'll get a date that you can use

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Cheers
Manuel

 

View solution in original post

7 REPLIES 7
manuelstgomes
Super User II
Super User II

Hi @PowerAppUser87 

 

Excel stores internally the dates as sequential serial numbers starting from January 1, 1900, to enable calculations. 

 

So you need to define a date for January 1, 1900, and add the value returned by Excel. Notice that that value is serial number 1 so you need to take two days in the final calculation. Why 2? The first is because the count starts at one and not zero, so you need to take that number off; otherwise, you'll. The other one is a little bit more tricky. For some reason, if you only subtract one, it will display the next day. 

 

Here's a structure of steps.. You can do them all in the "compose" action with formula, but I wanted to show each step.

 

small-Screenshot 2019-09-20 at 09.09.42.png

 

First, the date is a string, so we need to convert it into an int.

 

 

int(body('Get_a_row')?['Date'])

Then take the two days off

 

 

And finally, add the days.

 

addDays('01/01/1900',variables('Date'),'dd/MM/yyyy')

 

 

With this, you'll get a date that you can use

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Cheers
Manuel

 

View solution in original post

jpheeter
Regular Visitor

Hi @PowerAppUser87 

I've been tossing this into the fx field and it seems to work pretty well. 

addDays('12/30/1899',int(items('Apply_to_each')?['Due Date']),'yyyy-MM-ddTHH:mm:ss')

The part in red comes from the excel date field, I just converted the serial date to an int in line. I also figured it was faster to just change the start date to account for the 2 days added in the count. @manuelstgomes gave a great explanation in his answer that lead me to my inline tweak.

You were right!  With '01/01/1900' being used, the output was 2 days too many, while '12/30/1899 is accurate.

Yesss!! I used this as an expression, and it worked without all the variables and conversions. Thank you very much!!

juanortiz
New Member

For me was enough with select ISO 8601 in the DateTime format when get the rows in the table excel:

juanortiz_0-1615515570830.png

 

Powerplatform01
Post Patron
Post Patron

@PowerAppUser87 

Watch this video to resolve your issue.Also request you to please subscribe

https://youtu.be/NLEMPn-T3ns

Brilliant, thanks for sharing this tip.  All my imported decimal date time stamps magically changed to the required iso format. Thankyou @juanortiz 

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.

Users online (972)