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 / Dates and Times in Pow...
Power Apps
Unanswered

Dates and Times in Power Fx causing Formula Errors!

(0) ShareShare
ReportReport
Posted on by 32

Hey everyone,

I'm working on a formula in Power Fx that subtracts the end date from today's date. I'm encountering some data type errors because the NOW() function includes both date and time, causing issues with calculations. Ideally, I'd like to use a function that only considers the date portion.

viet561995_4-1718612862099.png

 

In my current formula, even though the end date and the result of NOW() show the same date (e.g., 17/6 or 17 Jun), the difference (DATEDIFF) is -1 instead of the expected 0.
viet561995_3-1718612854690.png


Any suggestions on how to tackle this? I'm looking for ways to calculate date only
Thanks in advance for your help!

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    153,051 Most Valuable Professional on at

    Hi @viet561995 ,

    Try

    DateDiff(
     'End Date',
     Today()
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • viet561995 Profile Picture
    32 on at

    Thanks for the suggestion! Unfortunately, I already tried using TODAY() in Power Fx, but it seems that function isn't supported. That's why I was using NOW() instead.

    viet561995_0-1718613656419.png

     

  • WarrenBelz Profile Picture
    153,051 Most Valuable Professional on at

    Hi @viet561995 ,

    Today() certainly is supported 

    WarrenBelz_0-1718614051284.png

    I am assuming 'End Date' in your formula is actually a valid date field or value.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

     

  • anandm08 Profile Picture
    1,936 Super User 2024 Season 2 on at

    try :

    Abs(DateDiff(
     'End Date',
     Today()
    ))
  • viet561995 Profile Picture
    32 on at

    Thanks for your reply,

     

    In my case, I'm actually working within the model-driven app, not canvas app. in this model driven app, the Power Fx is in preview mode. Im thinking the TODAY() function might not be available in the preview mode yet so i am trying to find another solution.

     

    Additionally, I can confirm that the End Date field in my model-driven app is set up as a date only type field, so it's not storing any time information.

    viet561995_0-1718614540435.png

     

  • WarrenBelz Profile Picture
    153,051 Most Valuable Professional on at

    @viet561995 ,

    That is also a very good thing to post initially - I will have to step away here as I do not use them.

  • CU09102019-0 Profile Picture
    2 on at
    Hello,
     
    please try next solution: 
    DateDiff('Date Observed', UTCToday())

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 711 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 319 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard