# Thread: Date Calculations

1. Registered User
Join Date
Jan 2005
Posts
165

## Unanswered: Date Calculations

I'm doing a query which involves dates. We have a date column when a payment is due. I would like to display the difference in days between today's date and the due date. is this even possible? Thanks for any help!!!!

2. Grand Poobah
Join Date
Sep 2003
Location
MI
Posts
3,713
Yes. Try looking at the DateDiff function ...

3. Registered User
Join Date
Jan 2005
Posts
165
I got that to work but when it displays the difference, my numbers end up looking like this: 5.26468435165. is there a way to make these numbers round up to the nearest whole number? Thanks

4. Registered User
Join Date
Dec 2004
Posts
277
set the decimal place to 0

as far as goin up to the higher number i'll try and get back to you i forget

-------------------------
forget all that

something is wrong within your code for that to be coming up like that

DateDiff("d",[Field1],[Field2])
Last edited by DackJaniels; 01-28-05 at 16:03. Reason: stupid thinking

5. Registered User
Join Date
Jun 2004
Location
Florida, US
Posts
521
how did you get decimal numbers from datediff function??

later edit: yes, follow DackJaniel's datediff format. you should get the exact difference of the dates

6. Moderator
Join Date
Dec 2004
Location
Posts
3,928

## Date

Why not just try: PaymentDueDate = Date() - DueDate

or

PaymentDueDate = DueDate - date()

Maybe I misunderstood your question.

7. Registered User
Join Date
Aug 2003
Location
Cleveland USA
Posts
184
Try CInt([Date1]-[Date2]). You get the decimal places because the date also has a time stored in there, and the answer will be in days. Note that if the dates are the same, the answer will be "1", not "0". With DateDiff, I think you can actually get 0 if the dates are the same, and you don't get the decimal part, so it's the better choice if you can get it to work. You can also calculate the difference in years or months, not just days.

8. Registered User
Join Date
Jun 2004
Location
Florida, US
Posts
521
if you give "d" parameter to Datediff function you only get difference of the days and it will be an integer.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•