There MUST be a better way - calculating intervals between 2 dates

S

Sue

I want to calculate time intervals between 2 dates - today and a
user-specified date in the past. I fiddled around & came up with the
following fomulae:

Int(Now()-[D1Tx]) -> the # of days between D1Tx and today
Int((Now()-[D1Tx])/7) -> the # of weeks between D1Tx and today
Int((Now()-[D1Tx])/365) -> the # of years between D1Tx and today

The problem is that these don't show any difference between (1 year + 1 day)
and (1 year + 364 days). How do I make these formulae - especially the last -
a bit more meaningful?

And what if I'd also like the user to be able to enter the past date of
interest and a date other than today, i.e. if they want to know what the
interval will be when there's an appointment in the future in which the
interval between the past date and the date of that future appointment?

Hope I'm not being TOO incoherent.

Thank you!
 
B

Bob Barrows [MVP]

Sue said:
I want to calculate time intervals between 2 dates - today and a
user-specified date in the past. I fiddled around & came up with the
following fomulae:

Int(Now()-[D1Tx]) -> the # of days between D1Tx and
today Int((Now()-[D1Tx])/7) -> the # of weeks between D1Tx
and today Int((Now()-[D1Tx])/365) -> the # of years between
D1Tx and today

The problem is that these don't show any difference between (1 year +
1 day) and (1 year + 364 days). How do I make these formulae -
especially the last - a bit more meaningful?

And what if I'd also like the user to be able to enter the past date
of interest and a date other than today, i.e. if they want to know
what the interval will be when there's an appointment in the future
in which the interval between the past date and the date of that
future appointment?

Hope I'm not being TOO incoherent.

Thank you!

You might look into the builtin DateDiff function ...
 
D

Duane Hookom

Doug Steele has a more complete DateDiff() function at
http://www.accessmvp.com/djsteele/Diff2Dates.html.

--
Duane Hookom
Microsoft Access MVP


Bob Barrows said:
Sue said:
I want to calculate time intervals between 2 dates - today and a
user-specified date in the past. I fiddled around & came up with the
following fomulae:

Int(Now()-[D1Tx]) -> the # of days between D1Tx and
today Int((Now()-[D1Tx])/7) -> the # of weeks between D1Tx
and today Int((Now()-[D1Tx])/365) -> the # of years between
D1Tx and today

The problem is that these don't show any difference between (1 year +
1 day) and (1 year + 364 days). How do I make these formulae -
especially the last - a bit more meaningful?

And what if I'd also like the user to be able to enter the past date
of interest and a date other than today, i.e. if they want to know
what the interval will be when there's an appointment in the future
in which the interval between the past date and the date of that
future appointment?

Hope I'm not being TOO incoherent.

Thank you!

You might look into the builtin DateDiff function ...
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
 
S

Sue

How? Obviously I'm at sea.
--
Thanks for your time!


Bob Barrows said:
Sue said:
I want to calculate time intervals between 2 dates - today and a
user-specified date in the past. I fiddled around & came up with the
following fomulae:

Int(Now()-[D1Tx]) -> the # of days between D1Tx and
today Int((Now()-[D1Tx])/7) -> the # of weeks between D1Tx
and today Int((Now()-[D1Tx])/365) -> the # of years between
D1Tx and today

The problem is that these don't show any difference between (1 year +
1 day) and (1 year + 364 days). How do I make these formulae -
especially the last - a bit more meaningful?

And what if I'd also like the user to be able to enter the past date
of interest and a date other than today, i.e. if they want to know
what the interval will be when there's an appointment in the future
in which the interval between the past date and the date of that
future appointment?

Hope I'm not being TOO incoherent.

Thank you!

You might look into the builtin DateDiff function ...
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
 

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