date calculation

1. Junior Member
Join Date
Dec 1969
Posts
24

## date calculation

Ive read all the stuff on date functions nad calculations on this site but i cant find anything that mentions how you would subtract two dates, for example a birthday and the day of death, from data in a database and how many days inbetween, as in this example, lifespan in days. anyone know how or know any tutorials? thanks in advance

2. Senior Member
Join Date
Dec 1969
Posts
11,247

## DateDiff(Interval, Date1, Date2)

select DateDiff("d", DOB, DOD)as no_of_days from &#060;table&#062;<BR><BR>or <BR><BR>SELECT DATEDIFF(day, DOB, gDOD) AS no_of_days from &#060;table&#062;<BR><BR>access -- sql respectevly

3. Senior Member
Join Date
Dec 1969
Posts
96,118

## DateDiff *IS* in the docs...

...but as it turns out if you want a diff in *DAYS* (only) you can easily do that with simple subtraction:<BR><BR> someDay = #4/24/2004#<BR> dayCount = someDay - Date()<BR><BR>If your variable(s) might have a time component in them, just use the DateValue function to get rid of it:<BR><BR> someDay = #4/24/2004 10:15:30 AM#<BR> dayCount = DateValue( someDay ) - Date()<BR><BR>

#### Posting Permissions

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