cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
TomasG
Advocate II
Advocate II

Invalid date format extract from PDF

Hi, 

I use encodian @Jay-Encodian   "extract text from regions" from PDF. I want to store it into SP list. Output of extraction is JSON. Structure of JSON is {"name_of_variable": value}. It contains dates (example. {"date_of_birth": "20.03.2021"}). The value is string!

Problem is saving into SP list, into date column. When I want to store it, I need to format into dateFormat. 


I create expression formatDateTime(body('Parsovat_JSON')?['datumVystaveno'],'dd.MM.yyyy').

I tried it with 2 "string" dates. When I try it with date  "8.03.2021" it gives result 03.08.2021.
But this is problem, because:

  • "08" representing day
  • "03" representing month
  • "2021" is year.

This is the first problem. Second problem is, when I use "string" date "17.01.2021" the whole flow fails.
Error alert is cca: "The value specified for the date and time string 17.01.2021 in the formatDateTime function is not valid. The datetime string must conform to the ISO 8601 format."

I tried to switch formatDateTime("variable", 'MM.dd.yyyy') instead of 'dd.MM.yyyy'. It works for first example and it gives correct date 08.03.2021. But in the second example it fails. 

Have you anybody some experience with this? Or have any advice for me, Thanks lot. 

1 REPLY 1
Paulie78
Super User
Super User

If the string you are getting back is 20.03.2021 and you want to put that into a SharePoint date field you need to create an expression to convert that to 2021-03-20. Then it will work just fine. You can split your string on the dot between the date parts and reformat it into the correct format. Are you familiar with how to do that or would you like a bit of help with the expression?

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (1,282)