cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mjp1973
Helper I
Helper I

String Conversion question String to Date and should fit into "Date" column in Sharepoint library

I get from a JSON schema a string value with a date and time in it, looks like that  2014:05:22 17:02:16    means yyyy:MM:dd plus time  . It is some kind of meta data propery I get as string and can also save it like that in a string column within a sharepoint library.

Now I added a "Date" formated column in that SP library and that library expects a format like d.M.yyyy without time. Just mapping the string field to that date column ends up with Errrors in PowerAutomate.

How to convert that string 2014:05:22 17:02:16    to     22.5.2022  and without time to avoid such errors. I tried several things but always end up with errors.

That string field with the date is a  dynamic value dateTimeDigitized .....in expressions like that ('Parse_JSON')?['properties']?['dateTimeDigitized'])

mjp1973_0-1669328002821.png

 

mjp1973_1-1669327497388.png

 






1 ACCEPTED SOLUTION

Accepted Solutions
abm
Super User
Super User

Hi @mjp1973 

 

Try the below:

 

image.png

 

Expression I used above is:

 

formatDateTime(replace(first(split(outputs('Compose'),' ')),':','-'),'dd.MM.yyyy')
 
Thanks


Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials

View solution in original post

6 REPLIES 6
abm
Super User
Super User

Hi @mjp1973 

 

Try the below:

 

image.png

 

Expression I used above is:

 

formatDateTime(replace(first(split(outputs('Compose'),' ')),':','-'),'dd.MM.yyyy')
 
Thanks


Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials
mjp1973
Helper I
Helper I

Thanks a lot @abm for your reply . I will try that today and when it works i will accept it as solution. 

Hi @abm ,

It will not work this way. It does not like the Compose2 output. I have placed the dynamic value dateTimeDigitized in Compose and the expression in Compose2. Maybe Compose is not right there.

mjp1973_0-1669369761638.pngmjp1973_1-1669369839310.png

that is what es output comes from JSON

mjp1973_2-1669370074330.png
mjp1973_3-1669370119949.png

 

Ajinder31
Continued Contributor
Continued Contributor

Hi @mjp1973 , The expression provided seems correct. Can you please confirm the output of the Compose action?
Error message seems to suggest null value returned from Compose action.


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

Hi @mjp1973 

 

I did test it and worked as expected. Here the issue is your data. Make sure you have date in that compose. If not add an IF condition to avoid all related action steps.

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials

Hi @abm the issue is not your expression, that seems to work. The issue is that Update file properties cannot really handle dynamic values because when run the flow all columns here yellow marked do not appear in the output means then any expression would fail. The JSON action output still shows all the correct values but Update file properties does not show the important values in the output means when I apply your expression it fails anyway. I guess that seems to be a problem with Update files properties.

mjp1973_0-1669456621993.png

 

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Users online (1,531)