Calculate the difference between 2 dates (1 Viewer)

araza123

New member
Local time
Yesterday, 19:29
Joined
Apr 6, 2022
Messages
24
Hi all,

I am trying to simply find the difference between 2 dates in my querey. I want the result to be listed in days

i presently have it as
Difference: DateDiff('d',[Claim Entered Date]-[Sale Date Ky],Date())

but this is not yielding the correct results. Anyone know what I am doing wrong here? Thanks in advance

1650314592844.png
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 17:29
Joined
Oct 29, 2018
Messages
21,449
To get the difference between two dates, you can use either:

Date1 - Date2

or

DateDiff("d", Date1, Date2)
 

Gasman

Enthusiastic Amateur
Local time
Today, 01:29
Joined
Sep 21, 2011
Messages
14,221
DateDiff calculates between two dates.
You are making one of them a stupid number by subtracting one from another.
 

Pat Hartman

Super Moderator
Staff member
Local time
Yesterday, 20:29
Joined
Feb 19, 2002
Messages
43,213
Perhaps your expression should be:

Difference: DateDiff('d',[Claim Entered Date]-[Sale Date Ky])

PS, it is poor practice to use embedded spaces or special characters in your names. You should also avoid like the plague any function or property names, especially "Name" and "Date" since both of these will cause unexpected results in certain circumsatances.
 

Users who are viewing this thread

Top Bottom