Power Automate: SharePoint OData Filter Queries for DateTime & utcNow() [Examples]

This article continues from our previous guide about date-only filtering, focusing on DateTime columns (date + time components).

For date-only filtering (e.g., “Birthday”), please see our previous article:
Power Automate: Filter by Date (Date-only)

スポンサーリンク

The DateTime Format Difference

While date-only filters use the simple “2024-10-19” format, DateTime filters in SharePoint OData queries require the ISO 8601 format: “2024-10-19T00:00:00Z“.

Key Components:

  • T : Separator between the date and time components.
  • Z : Indicates UTC time standard. (For Japan Standard Time, you would use “+09:00” instead of “Z”).

The biggest advantage of DateTime filters over date-only filters is that you can use the utcNow() function directly without manual timezone conversion.

This works because the timezone suffix (“Z” or “+09:00”) tells SharePoint exactly which moment in time you mean, allowing it to handle the conversion automatically.

※We’ll explain why this works in the bonus section at the end.

For example, these two filter expressions target the exact same moment:

// Japan Time: Oct 19, 00:00
dateTime eq '2024-10-19T00:00:00+09:00'

// UTC Time: Oct 18, 15:00 (Equivalent to Oct 19, 00:00 JST)
dateTime eq '2024-10-18T15:00:00Z'

Functions and Operators Cheat Sheet

As in our previous article, we’ll use these standard OData operators:
Operators

  • eq : equals ( = )
  • gt : greater than ( > )
  • ge : greater than or equal to ( >= )
  • le : less than or equal to ( <= )
  • lt : less than ( < )
  • and : AND operator

Practical Examples (Copy & Paste)

Setup for this demo:
We are using a SharePoint site with the timezone set to (UTC+09:00) Osaka, Sapporo, Tokyo.
SharePoint Timezone Settings
Target List:
We will apply filters to this list:
Target SharePoint List
Note on Testing:
Debugging utcNow() in real-time is tricky because the time keeps changing. For these examples, we use a variable representing “Oct 19, 00:00 JST” to simulate the current time.
Power Automate Variable Setup

1. Get items older than now (Past)

Use this to archive old items or find past due tasks.

Expression

dateTime le '@{utcNow()}'
// Use 'lt' to exclude the exact current second

Result
Result: Items older than now

2. Get items newer than now (Future)

Use this to find upcoming appointments or scheduled tasks.

Expression

dateTime gt '@{utcNow()}'
// Use 'ge' to include the exact current second

Result
Result: Items newer than now

3. Get items from the last 12 hours (Recent History)

Combining ge (start) and le (end).

Expression

dateTime ge '@{addHours(utcNow(), -12)}' and dateTime le '@{utcNow()}'

Result
Result: Items from last 12 hours

4. Get items occurring in the next 24 hours (Upcoming)

Useful for “Daily Digest” notifications.

Expression

dateTime gt '@{utcNow()}' and dateTime lt '@{addHours(utcNow(), 12)}'

Result
Result: Items in next 24 hours

5. Exact Match (Rare Case)

It is rare to match a DateTime column down to the exact second, but here is the syntax.

Expression

dateTime eq '@{utcNow()}'

Result
Result: Exact match

Related Articles

Bonus: Why SharePoint Handles Timezone Conversions So Well

Unlike Date-only columns, SharePoint stores DateTime columns with strict timezone awareness. Here is a quick experiment to prove it.

1. With the Site Timezone set to Japan (JST):
Site settings JST
2. We create an item with a specific time:
Item created in JST
3. If we change the Site Timezone to UTC:
Site settings UTC
4. The item’s display time shifts back exactly 9 hours:
Item display in UTC

Conclusion: SharePoint interprets your input time based on the site’s timezone settings at the moment of entry and stores it internally as UTC. When you filter using utcNow() (which is Z/UTC), SharePoint compares it correctly against that internal UTC value.

Copied title and URL