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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Can't get formateDateT...
Power Automate
Unanswered

Can't get formateDateTime to work with Ticks

(0) ShareShare
ReportReport
Posted on by 51

Hi there,

 

I have a simple flow which takes a StartDate and an EndDate both of which are pulled from a list in yyyy-MM-dd format.

 

When I add this to calculate the difference in days between the dates using the ticks method it keeps saying "The datetime string must match ISO 8601 format.'."

 

Here is the line I'm using:

 

div(sub(ticks(formatDateTime('StartDate','yyyyMMdd')),ticks(formatDateTime('EndDate','yyyyMMdd')),864000000000))

 

Not sure what I'm missing here?

 

Thanks

 

David

Categories:
I have the same question (0)
  • fchopo Profile Picture
    8,003 Moderator on at

    Hi @DavidMullett 

    Could you use the following expression?:

    div(sub(ticks(formatDateTime('StartDate','yyyy-MM-dd')),ticks(formatDateTime('EndDate','yyyy-MM-dd')),864000000000))

    You should use ISO 8601 to make those datetime calculations.

    Hope it helps!

    Ferran

  • DavidMullett Profile Picture
    51 on at

    Thanks Ferran,

     

    Unfortunately I had attempted that format. I copied your expression in just in case but still throws this error. I've attached a shot showing what the varibles are going in as well.

     

    flow.png

     Thanks

    David

  • Verified answer
    v-bofeng-msft Profile Picture
    on at

    Hi @DavidMullett :

    Please try:

    div(
     sub(
     ticks(formatDateTime(variables('EndDate'))),
     ticks(formatDateTime(variables('StartDate')))
     ),
     864000000000)

    vbofengmsft_0-1633588213535.png

    Result:

    vbofengmsft_1-1633588239146.png

    Best Regards,

    Bof

     

  • DavidMullett Profile Picture
    51 on at

    Brilliant, thanks! That worked a treat.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard