web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / AI model: Date extract...
Power Automate
Answered

AI model: Date extraction from Invoice

(0) ShareShare
ReportReport
Posted on by 264

Hi,

I am currently working on an AI model where it extracts information from Invoices and passes this information to Power automate flow, which then stores information in excel.

In one of the Invoice collection, the model captures date correctly i.e. 11/08/2021

But while storing this date information in Excel, it changes the format to 8/11/2021

 

For other invoice collection, the AI model is storing the date information correctly.

Does anyone know what is wrong with my flow, why is it changing the date format for only 1 invoice collection?

 

Any help is appreciated.

Categories:
I have the same question (0)
  • Verified answer
    CedrickB Profile Picture
    Microsoft Employee on at

    Hi,

    String to date conversions are often akward.

    11/08/2021 european format is also 8/11/2021 in US format.

    The best way to handle it is to check the local of your Excel file and perform some parsing of the string before inserting to Excel.

     

    So use below to capture

    - DAY:  

    substring(variables('MyDate'), 0, indexOf(variables('MyDate'), '/'))

    - MONTH: 

    substring(variables('MyDate'), add(indexOf(variables('MyDate'), '/'), 1), 2)

    - YEAR: 

    substring(variables('MyDate'), add(lastIndexOf(variables('MyDate'), '/'), 1), 4)

     

    Then if your Excel expects US format you can assemble it like that

    concat(
      substring(variables('MyDate'), 0, indexOf(variables('MyDate'), '/')),
      '/',
      substring(variables('MyDate'), add(indexOf(variables('MyDate'), '/'), 1), 2),
      '/',
      substring(variables('MyDate'), add(lastIndexOf(variables('MyDate'), '/'), 1), 4)
    )

     

    Swap the 1st and 3rd terms if European format is expected.

    I hope it will help.

  • Paul_M Profile Picture
    264 on at

    Hi @CedrickB ,

    Thank you for that.

    Quick questing, how do you define the AI model to understand the capture data is European or US format.

    I have 50 collection of invoice and some have European format and some have US format date.

    Is there a way to define it?

     

  • CedrickB Profile Picture
    Microsoft Employee on at

    Unfortunatelly, it is not possible at the moment.

  • KVa Profile Picture
    115 on at

    Any update on the locale of the date and number parsing? I'm currently having problems with parsing commas in numbers and dates.

  • CedrickB Profile Picture
    Microsoft Employee on at

    There is no built-in way to perform this.

    So you should create some customization logic depending on your use case 

    1. If you always have the same number format, you can apply some text parsing function with a method similar as above with dates.

    2. If you have inconsistent number,.you can have store the information of the locale by vendor in a table. When the vendor name is extracted, you perform a look up to this table to get the locale and apply the appropriate text parsing logic.

  • KVa Profile Picture
    115 on at

    Thank you, @CedrickB . Understood, I need to do further processing in order to obtain the date / number.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 592

#2
Valantis Profile Picture

Valantis 340

#3
11manish Profile Picture

11manish 284

Last 30 days Overall leaderboard