access date finction

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How to compute two date equal?year?month?day?
Example:
#2006-02-23# - #1990-01-24# =16 year 0 month 29 day
 
I have one that shows years and months. You could modify it slightly to
meet your needs...


=DateDiff("m",[Spousebday],Date())\12 & " yrs. " &
(DateDiff("m",[spousebday],Date()) Mod 12 & " mts.")

This uses the field "Spousebday" and compares it to the current date. You
could use whatever field values you'd like. If you don't want to subtract
from the current date, then you'd need to replace "DATE()"" with your field
name.
 
Try the "More Complete DateDiff Function" Graham Seach and Doug Steele
wrote.

http://www.accessmvp.com/djsteele/Diff2Dates.html

You specify how you want the difference between two date/times to be
calculated by providing which of ymdhns (for years, months, days, hours,
minutes and seconds) you want calculated.

For example:

?Diff2Dates("y", #06/01/1998#, #06/26/2002#)
4 years
?Diff2Dates("ymd", #06/01/1998#, #06/26/2002#)
4 years 25 days
?Diff2Dates("ymd", #06/01/1998#, #06/26/2002#, True)
4 years 0 months 25 days
?Diff2Dates("d", #06/01/1998#, #06/26/2002#)
1486 days

?Diff2Dates("h", #01/25/2002 01:23:01#, #01/26/2002 20:10:34#)
42 hours
?Diff2Dates("hns", #01/25/2002 01:23:01#, #01/26/2002 20:10:34#)
42 hours 47 minutes 33 seconds
?Diff2Dates("dhns", #01/25/2002 01:23:01#, #01/26/2002 20:10:34#)
1 day 18 hours 47 minutes 33 seconds

?Diff2Dates("ymd",#12/31/1999#,#1/1/2000#)
1 day
?Diff2Dates("ymd",#1/1/2000#,#12/31/1999#)
-1 day
?Diff2Dates("ymd",#1/1/2000#,#1/2/2000#)
1 day

Rick B said:
I have one that shows years and months. You could modify it slightly to
meet your needs...


=DateDiff("m",[Spousebday],Date())\12 & " yrs. " &
(DateDiff("m",[spousebday],Date()) Mod 12 & " mts.")

This uses the field "Spousebday" and compares it to the current date. You
could use whatever field values you'd like. If you don't want to subtract
from the current date, then you'd need to replace "DATE()"" with your
field name.


--
Rick B



Lee said:
How to compute two date equal?year?month?day?
Example:
#2006-02-23# - #1990-01-24# =16 year 0 month 29 day
 
Back
Top