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 / ISO 8601 format error ...
Power Automate
Answered

ISO 8601 format error when using Ticks function

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello everyone,

 

I have a data set, in which there are an average of 190 items. Each item comes with a date and time. I need to subtract incoming dates and times from instant dates and times. Therefore, I use the ticks function for both dates separately, while I do not have a problem when I do it for the current date, I get an error when processing the date and time data from my dataset with the ticks function.

The sample date and time data I received is as follows: '20230426 000900.000'

The ticks function content I use is as follows:  ticks(formatDateTime(item()?['X']),'yyyyMMddTHHmmss.sss')

                                                                         ticks(formatDateTime(item()?['X']),'yyyyMMddTHHmmss')

                                                                         ticks(formatDateTime(item()?['X']),'yyyy-MM-ddTHH:mm:ss')

i tried each sample one by one but i always got the same error

 

The error message I got is as follows: Unable to process template language expressions in action 'Compose_5' inputs at line '0' and column '0': 'In function 'formatDateTime', the value provided for date time string '20230427 000200.000' was not valid. The datetime string must match ISO 8601 format.'.

mtndnmz_0-1682597391675.png

 

Categories:
I have the same question (0)
  • Verified answer
    Pstork1 Profile Picture
    69,129 Most Valuable Professional on at

    YOur sample date/time isn't in ISO 8601 format so it can't be converted to a Date/Time by the format string.  YOu are trying to use FormatDateTime to take a non-iso8601 string and make it an Iso 8601 string.  FormatDateTime isn't designed to do that. Since Power Autoamte doesn't have a Text Format function you'll need to use a combination of Concat() and Slice(). Something like this

    concat(
    slice(item()?['X'], 0, 4), '-', 
    slice(item()?['X'], 4, 6), '-', 
    slice(item()?['X'], 6, 8), 'T',
    slice(item()?['X'], 9, 11), ':',
    slice(item()?['X'], 11, 13), ':',
    slice(item()?['X'], 13, 19), 'Z')
  • Chriddle Profile Picture
    8,672 Super User 2026 Season 1 on at

    You should consider function parseDateTime() for this.

    Also function dateDifference() might be useful here.

  • Pstork1 Profile Picture
    69,129 Most Valuable Professional on at
    That's a good thought, but I don't think ParseDateTime will work since this isn't a locale specific date time string. The input for parseDateTime has to be a recognizable datetime string for a particular locale.
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thank you for your suggestions. The problem is solved when you use the concat and slice function as you said.

  • Chriddle Profile Picture
    8,672 Super User 2026 Season 1 on at

    parseDateTime('<timestamp>', '<locale>'?, '<format>'?) 

    parseDateTime('20230426 000900.000', 'es-es', 'yyyyMMdd HHmmss.000')

    returns 2023-04-26T00:09:00.0000000

     

     

    dateDifference(
    	parseDateTime('20230426 000900.000', 'es-es', 'yyyyMMdd HHmmss.000'),
    	parseDateTime('20230501 130000.000', 'es-es', 'yyyyMMdd HHmmss.000')
    )

    returns 5.12:51:00

  • Pstork1 Profile Picture
    69,129 Most Valuable Professional on at

    I stand corrected.  I didn't think it would work on a string without a more obvious format.

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