Skip to main content

Notifications

Power Automate - General Discussion
Answered

How do I fix the DateTime string in my flow?

Posted on by 10

Hello,

 

I've been trying all the troubleshooting suggested here on the Microsoft community to fix my problem but nothing is working. If anyone could take a look at what I've done and figure out what's wrong I'd be really grateful.

 

Every time I run my flow I receive this message:

The error indicates that the flow failed because the date string being used in the filter query is not recognized as a valid DateTime. This issue is likely caused by the format of the date being passed in the filter query, which may not match the expected format for SharePoint. To resolve this, have you considered ensuring that the date string is formatted correctly before using it in the filter query?

 

This is the variable:

dateDifference(convertFromUtc('2018-01-01T08:00:00.0000000Z', 'AUS Eastern Standard Time'), addDays(convertFromUtc('2018-01-01T08:00:00.0000000Z', 'AUS Eastern Standard Time'), 7))

 

This is the Get Items action that is failing:

Image

 

And this is the column "field_7" that it is trying to read for "eq":

Image

 

Thank you

Categories:
  • Verified answer
    LB-20090315-0 Profile Picture
    LB-20090315-0 10 on at
    How do I fix the DateTime string in my flow?
    Hi,
     
    It's always the simplest thing. Turns out I was using the wrong function. I've changed it to the correct one now and it's working fine. Thank you all so much for your help!
  • David_MA Profile Picture
    David_MA 6,664 on at
    How do I fix the DateTime string in my flow?
    The expression you are using is going to return a string representing days,hours:minutes:seconds (in your example, 7.00:00:00). You are trying to use a query filter where one date equals another date. Since your expression returns a string and not a date, this is the cause of your error. Since I don't know what you are trying to do, I cannot help you fix it, only give you the reason it does not work.
     
    To use equals in a query filter, the two sides of the filter must use the same data type (number to number, date to date, string to string, etc.). And when filtering on dates, both dates must be formatted using the ISO 8601 date format (yyyy-MM-dd). If the screen shot of field7 is from a SharePoint list, that will be stored in SharePoint in that format even though it displays in the list differently.
  • CFernandes Profile Picture
    CFernandes 7,905 on at
    How do I fix the DateTime string in my flow?
    Hey Mate,
     
    You need to replace yourDate with 'Due Date'
     
    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
     
    P.S. take a look at my blog here and like & subscribe to my YouTube Channel thanks.

     
  • LB-20090315-0 Profile Picture
    LB-20090315-0 10 on at
    How do I fix the DateTime string in my flow?
    Hello, thank you for the suggestions.
     
    The Due Date variable is a string. 
     
    I attempted to add a compose but it would not accept formatDateTime(yourDate, 'yyyy-MM-ddTHH:mm:ssZ') as a valid formula. I assume I'm supposed to change yourDate but I don't know what to change it to.
     
    Kind Regards,
    Lauren
  • Suggested answer
    CU15102032-0 Profile Picture
    CU15102032-0 10 on at
    How do I fix the DateTime string in my flow?
    It seems like you're using Due Date in a variable. Check is that variable a string?
  • CFernandes Profile Picture
    CFernandes 7,905 on at
    How do I fix the DateTime string in my flow?
    Hey Mate,
     
    Format the date string to ISO 8601 before using it in the filter query.
     
    Try the following, Add a Compose and use the Formula
    'formatDateTime(yourDate, 'yyyy-MM-ddTHH:mm:ssZ')
     
    Then past the output of the Compose to Filter.
     
     field_7 eq '<Compose>'

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

September 2024 Newsletter…

September 2024 Community Newsletter…

Community Update Sept 16…

Power Platform Community Update…

Tuesday Tip #2 Global Search…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 142,008

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 63,531

Leaderboard

Featured topics