Number of Days formula

G

Guest

What is the best way to calculate the number of days between 2 dates. For
example:

current date - due date= number of days

The dates are in fields in a table, when I tried setting it up like
=[field1] - [field2]

field 2 is the current date =Date()
and it did not work

Any help would be apreciated.
 
G

Guest

To get the different between two dates in Years, days, Month, weeks etc you
can use the datediff function

=DateDiff("d",StartDate,EndDate) ' Will return the diferent in days
 
F

fredg

What is the best way to calculate the number of days between 2 dates. For
example:

current date - due date= number of days

The dates are in fields in a table, when I tried setting it up like
=[field1] - [field2]

field 2 is the current date =Date()
and it did not work

Any help would be apreciated.

"did not work" is not very informative.
You got nothing? A #Error?, The wrong number of days? What?

=[Field1]-[Field2] should work if both fields contain valid dates.

=[field1] - date() (or = Date() - [field1] depending upon which is
greater) will also determine the number of days difference between
them.

You could also use the DateDiff function:
=DateDiff("d",[Field1],[Field2])

Make sure the name of the control is not the same as the name of a
field in it's control source expression.
 
R

Rick B

You say that field 2 is the current date? You don't store the current date
it will be wrong tomorrow.

To see how old an item is (in days) do the following...

=DateDiff("d",[Field1],Date())




Date() will return the current date.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top