Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to compare DateTime with Date?

Hello everyone,

So I have this code to get data for today. My current way of comparing is to convert both the dateTime and Date into the same text format.
LookUp(MyTable, Text(CreatedOnDateTime, "[$-en-US]dd/mm/yyyy") = Text(Today(), "[$-en-US]dd/mm/yyyy"))

Is there any easier/simpler expression to compare dateTime with date? Thanks in advance.

Power Apps
Power Apps

Do you want your comparison to succeed only if the time part of the date/time expression is zero (00:00:00)? If so, then you can compare them directly:

LookUp(MyTable, CreatedOnDateTime = Today())

If you want to compare using only the date part of the DateTime expression, then you will need to use a conversion. Your solution is good, or you can also create a new Date value from the DateTime:

    Date(Year(CreatedOnDateTime), Month(CreatedOnDateTime), Day(CreatedOnDateTime)) = Today())

Helpful resources

New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users


We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (52,410)