query using datediff to calculate time in years and months

D

Dow_Jones

I wish to query my data and retrieve the following information.

Start Date = 1/1/2000
Today's date = 3/23/2009

The results of the query should reflect "9 years 3 months". Is this
possible? If so, what is the formula / expression to gain this info?

Thanks to all.
 
J

Jerry Whittle

Format(Date() - #1/1/2000#, "yy m") & " Years/Months"

The above will be a problem if the start date is over 100 years before the
current date.
 
M

MGFoster

Jerry said:
Format(Date() - #1/1/2000#, "yy m") & " Years/Months"

The above will be a problem if the start date is over 100 years before the
current date.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

That's a neat answer, but the month value would include the partial
month of March. If the OP wanted just completed months then this
formula may be used:

DateDiff("m", #1/1/2000#, Date())\12 & " Years " & _
DateDiff("m",#1/1/2000#, Date()) Mod 12 & " Months"

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBScgfiIechKqOuFEgEQJoWACgsEPh7DhVnYmx/Z5r0pBMQKO0z6UAoPcO
pg7/6ULrQ8ryojyX9xHc7tNB
=BuOi
-----END PGP SIGNATURE-----
 

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

Similar Threads


Top