This topic is locked

Calculate Age

9/29/2006 8:11:25 PM
ASPRunnerPro General questions
cagleyleslie author

I found your tutorial, how to use calculated fields:
Calculated field calculates "on the fly" and doesn't exist in database.

  • proceed to SQL query tab and check off the Edit SQL query manually box.
  • add your query. For example:
    Price Quantity as Total,

    Price
    0.05 as Tax
    What would you use to calculate someone's age from 'Birthdate' field? Thanks!

cagleyleslie author 9/30/2006

Ah nevermind. I got it to work with this:
DateDiff('yyyy',[DateOfBirth],Now())+Int(Format(Now(),'mmdd')<Format([DateOfBirth],'mmdd')) AS Age,

S
siddeville 10/2/2006

Ah nevermind. I got it to work with this:

DateDiff('yyyy',[DateOfBirth],Now())+Int(Format(Now(),'mmdd')<Format([DateOfBirth],'mmdd')) AS Age,


I typically use
Int((Date()-[dob])/365.25)