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 / Is there more to compa...
Power Automate
Answered

Is there more to comparing datetime strings?

(0) ShareShare
ReportReport
Posted on by 18
I have a workflow to be triggered from Teams Graph API whenever messages get updates (reacts). Since there don't appear to be direct events per react, I'm retrieving said chatMessage object and iterating each item in the reactions array.
 
On trigger I've snapshotted a datetime into the recent past say 30 seconds.
 
    "variables": [
      {
        "name": "recentNow",
        "type": "string",
        "value": "@addSeconds(utcNow(), -30)"
      }
 
Then for each reaction I check if the createdDateTime is greater.
 
  "expression": {
    "and": [
      {
        "greater": [
          "item()?['createdDateTime']",
          "@variables('recentNow')"
        ]
      }
    ]
  }
 
But it somehow always determines all including old datetimes are newer.
 
2025-03-20T10:05:58.43Z > 2025-03-20T10:18:53.8635391Z
2025-03-20T10:07:07.085Z > 2025-03-20T10:18:53.8635391Z
2025-03-20T10:19:23.118Z > 2025-03-20T10:18:53.8635391Z
 
I double check in Javascript and that compares correctly as expected. What is different about Power Automate compare operators?
Categories:
I have the same question (0)
  • Verified answer
    David_MA Profile Picture
    12,978 Super User 2025 Season 2 on at
    Please show how you are trying to do this in Power Automate and the issue you are having. As long as the date format is ISO8601, you can compare dates in Power Automate. Here is a blog post with a couple of examples of how to do this: Compare dates using conditions in Power Automate.
  • icelava Profile Picture
    18 on at
    I'm just using the standard Condition action with above expression.
     
     
  • icelava Profile Picture
    18 on at
    The ticks() conversion function makes it compare correctly. Thanks.

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 503 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 321 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard