cancel
Showing results for
Did you mean:
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:

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

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
Community Champion

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.

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

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

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

If you like my response, please give it a Thumbs Up.

Cheers
Manuel

11 REPLIES 11
Community Champion

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.

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

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

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

If you like my response, please give it a Thumbs Up.

Cheers
Manuel

Regular Visitor

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

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.

New Member

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

Helper I

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

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

Post Patron

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

Regular Visitor

For me, this IS the solution. Wish I had noticed that drop-down before trying repeatedly to convert the date. Thank you!

Kudo Collector

Thanks @manuelstgomes !

This has stumped me many times... maybe if I comment here I'll find the thread easier the next time this confuses me!

And here's the Google search which led me here:

``excel sharepoint power automate 5 digit date format``
Frequent Visitor

Hi

I have used exact same expression to get the date in date format however, I have having error as

OpenApiOperationParameterTypeConversionFailed. The 'inputs.parameters' of workflow operation 'Update_item' of type 'OpenApiConnection' is not valid. Error details: Input parameter 'item/Cargo_x0020_Ready_x0020_Date' is required to be of type 'String/date'. The runtime value '"30-06-2020"' to be converted doesn't have the expected format 'String/date' while writing to SP list. Do you have any suggestion?

Thanks

Kudo Collector

@Akuner Are you writing that date value to a "Date and Time" field in SharePoint list?

Might need to convert to Zulu time format, like "2020-06-30T00:00:00+00:00" or just "2020-06-30T00:00:00".

What does the value you are trying to write to SP list look like in a Compose action? Can you provide a screenshot? Like add a Compose action right before the 'Update_item' action, and put

``@{item()['Cargo_x0020_Ready_x0020_Date']}``

in that Compose. What does it look like, just "30-06-2020"?? To be clear, is your value a string like [30-06-2020] without the brackets, or is it double quoted within the string? Like open the flow run and click "view all outputs" on the Compose you just created. Does the JSON look like "\"30-06-2020\"" or "30-06-2020"?? There should only be one pair of double quotes around that value when you look at the JSON output of the compose action.

Converting date/time values in Power Automate is no picnic. Seems that you have a format which needs to be converted in the reverse direction from what is typical, and I've not been able to figure out a surefire way to do that with a simple function. So I would just use split(), concat(), and take() to manually compose the correct format in a function like this:

``@{concat(last(split(item()['Cargo_x0020_Ready_x0020_Date'],'-')),'-',last(take(split(item()['Cargo_x0020_Ready_x0020_Date'],'-'),2)),'-',first(split(item()['Cargo_x0020_Ready_x0020_Date'],'-')),'T00:00:00')}``

I have not tested that function but it should get you close to what you need.

Announcements

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

#### A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

#### Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

#### Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Top Solution Authors
Top Kudoed Authors
Users online (2,370)