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

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Conditions

(0) ShareShare
ReportReport
Posted on by 58
Hi,
 
I have a workflow with the below condition. It has stated TRUE even though the insurance date is greater than the contract end date not lesser than. 
 
Is this because I have used the field from Dynamic Content instead of the variable?  
 
I have the same question (0)
  • Srini007 Profile Picture
    3,287 Super User 2025 Season 2 on at
    Conditions
     
    The problem here is that you cannot compare with a string value with the Dates. You need to format it as a Date check below for your reference
     
    Let say I have two dates as 2024-11-25 and 2024-11-30
     
    Now write your expression as formatDateTime('2024-11-24', dd/MM/yyyy) is less than formatDateTime('2024-11-30', dd/MM/yyyy)
     
    The above bold is of your choice whether you need the format as dd/MM/yyyy or dd-MM-yyyy
     
    Check below for your reference
     
     
     
     
    If I have answered your question, please mark it as the Answered. If you like my response, please give it a Like.
     
    Regards,
    Srini
     
     
  • karenlacey Profile Picture
    58 on at
    Conditions
    Thank you for your response. Ok I understand, I have updated this now to these (2 screenshots just to show you what is each value) 
     
    Hopefully that does the trick. 
     
  • Verified answer
    Srini007 Profile Picture
    3,287 Super User 2025 Season 2 on at
    Conditions
     
    Yeah, Let us know if that works for you or facing any issue and need further help?
     
    If I have answered your question, please mark it as the Answered. If you like my response, please give it a Like.
     
    Regards,
    Srini
  • karenlacey Profile Picture
    58 on at
    Conditions
    Hi, I have ran the workflow but it gets these errors
     
    Unable to process template language expressions for action 'Condition' at line '0' and column '0': 'In function 'formatDateTime', the value provided for date time string '' was not valid. The datetime string must match ISO 8601 format.'.
     
    What am I doing wrong? 
     
  • Chriddle Profile Picture
    8,331 Super User 2025 Season 2 on at
    Conditions
    The problem here is that you cannot compare with a string value with the Dates. 
    This statement is wrong! In fact, in PA a date is a string and and you are doing string comparisons here.
     
    Now write your expression as formatDateTime('2024-11-24', dd/MM/yyyy) is less than formatDateTime('2024-11-30', dd/MM/yyyy)
    If you do this, '01/01/2024' is less than '30/01.1999' because string comparison works from left to right and '0' is less than '3'
     
    When comparing dates, ensure that the date is in ISO 8601 format (yyyy-MM-ddTHH:mm:ss, you might not need the time here), as returned by any PA date function.
     
    The datetime string must match ISO 8601 format.
    Function formatDateTime() expects a valid date string as input.
    If you value might be empty you either have to adapt your condition accordingly (check if empty before doing other checks that involve formatDateTime() or define a default value, see coalesce())
     
    But you probably don't need to use formatDateTime() at all if your dates are formatted correctly.
    If not, check parseDateTime()
     
  • karenlacey Profile Picture
    58 on at
    Conditions
    Thank you for your response. So if I forget about using the formatdatetime and just use it this way by using dynamic content? 
     
    I did enter it this way and the workflow ran without any errors. 
     

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 647 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 350 Moderator

#3
developerAJ Profile Picture

developerAJ 256

Last 30 days Overall leaderboard