The DateDiff function returns the difference between 2 dates in the specified unit. DateDiff function defaults to Days, but you can choose between Milliseconds, Seconds, Minutes, Hours, Days, Months, Quarters, or Years. If the second date occurs before the first DateDiff will return a negative number.
- No week in the list of choices, but you can perform the calculation based on the difference in days and RoundUp or RoundDown based on the metric that suits your app.
- The returned difference is always an integer number. If you need more granularity, you need to perform the math by yourself.
- Please note that Power Apps will only calculate the difference based on the metric used. For example, if you compare date in days where the first is “today at 3 pm” and the other is “tomorrow at 10 am” it will return one as the number of days, even if it’s technically less than one day between both dates.
- Always be aware of the order of the dates that you’re comparing. A negative time difference can be confusing to the end-user (the result of subtracting the most recent date with the other).
- Always use the metric that you need (except if you need more granularity). For example, don’t use DateDiffwith the default value and try to calculate the months. You may get invalid results, and there’s a convenient way for you to do it just by using Months.
- The dates are compared using the local timezone, so be aware of any differences in time zones in the data source to ensure correct results.
- Please note that formulas may have localization-based differences. For example, you should write
DateDiff(Today(),Now())with “,” separating each of the arguments, but if your localization is Portugal, you should use “;” instead
Back to the PowerApps Function Reference