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 Apps / Proper syntax for form...
Power Apps
Unanswered

Proper syntax for formatDateTime in power automate

(0) ShareShare
ReportReport
Posted on by 28

I am creating a list rows action where the list should be filtered for all rows where dateField = today.  dateField is only date, no year, in mm/dd/yyyy format.  When i try and set my filter to

 

dateField eq formatDateTime(utcNow(),'MM-dd-yyyy')

 

i get a syntax error.

 

Can anyone tell me what the correct filter is to check if a dateField = today with month/day/year only?

 

Thanks!

 

 
I have the same question (0)
  • ColdSpark Profile Picture
    28 on at

    *dateField is only date, no TIME, in mm/dd/yyyy format.

  • ColdSpark Profile Picture
    28 on at

    using 

     

    dateField eq '@{utcNow('MM-dd-yyyy')}'

     

    i can get the workflow to run without failure, but it does not return any records.  

     

    "parameters": {
            "entityName""entity",
            "$filter""dateField eq '03-16-2021'"
        }
     
    cant figure out what the syntax needs to be to compare utcnow to a date only dataverse field?
     
  • mahoneypat Profile Picture
    1,720 on at

    You need to put the utcNow() in an expression for it to work.  In my example, I used this expression successfully to filter a Dataverse date column.

     

    utcNow('yyyy-MM-dd')

     

    mahoneypat_0-1615896903468.png

     

    Regards,

    Pat

  • Drew Poggemann Profile Picture
    9,287 Most Valuable Professional on at

    Hi @ColdSpark,

     

    I had major challenges with date only fields in Dataverse.  The field is defined as "Date Only" but behind the scenes in Dataverse there was a time component still.  To get my functions to return what I needed I had to do a greater than and less than for a day in future to get this to actually work.   So I would do this (I know it is a pain):

    start of day:   

    formatDateTime(startofDay(utcNow()),'MM/dd/yyyy hh:mm:ss')
    beginning of tomorrow:
    formatDateTime(startofDay(addDays(utcNow(),1)),'MM/dd/yyyy hh:mm:ss')

    I would then query for dates in the dataverse that are >= on beginning and < ending.
     
    I know this is a big workaround and hopefully you don't have to do it and someone has a better idea but I had to do this about 6 months ago to get mine to work.
     
    Thanks,

    Drew

     

  • Verified answer
    Kundan Sah Profile Picture
    45 on at

    Hi,

    The date fields need to be set in below format YYYY-MM-DDT00:00:00Z and for datetime it would be YYYY-MM-DDThh:mm:ssZ

  • ColdSpark Profile Picture
    28 on at

    This was it! the proper format as listed by Kundan is YYYY-MM-DDT00:00:00Z.  Changed the hour to 7 to account for timezone.  Final eq was dateField eq below

     

    ColdSpark_0-1615916298098.png

     

  • MarioOne Profile Picture
    67 on at

    Hey Guys, I have still the issues on having this simple task completed; just need a daily dump from a SharePoint list. The fix suggested does not work for me;  whenever adding a rule to ODATA filter I am getting no data back.

     

    Either I go this way:

    MarioOne_0-1682073964726.png

    or that way:

    MarioOne_1-1682074016411.png

     

    I get no data back. If I skip filter query, I will get something like:

     

    MarioOne_2-1682074111586.png

    what is even more interesting, even though I am getting record created only on two dates...

    Any ideas? 🙂

     

     

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 Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard