Skip to main content
June 6, 2009
Answered

Want to program a feature to figure out users age from their birthday

  • June 6, 2009
  • 3 replies
  • 831 views

Hi,

I want to find out how to create a code where I could find out user's age from their birthday info. I'm using ms access and in my current set up i have users insert the month day and year of their birthday, that information gets inserted into a field called birthday in a database called users.

My question is, how could I find out their age and output their age(as a number of course) rather than outputting their entired birthday.

Thanks in advance for the help.

    This topic has been closed for replies.
    Correct answer JR__Bob__Dobbs-qSBHQ2

    Use the DateDiff function to determine the number of years between the date of birth and the current date.  You can use the Now function to get the current date.

    http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=functions-pt0_05.html#1098968

    3 replies

    tclaremont
    Inspiring
    June 10, 2009

    <CFSET DOB = whatever the date of birth is>

    #DateDiff("yyyy",DOB,Now())#

    No tweaking required.

    Inspiring
    June 8, 2009

    You might have to tweak the result by one depending on whether today's date is before or after the birthdate...

    JR__Bob__Dobbs-qSBHQ2Correct answer
    Inspiring
    June 6, 2009

    Use the DateDiff function to determine the number of years between the date of birth and the current date.  You can use the Now function to get the current date.

    http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=functions-pt0_05.html#1098968

    June 7, 2009

    Thank you for your help, I really appreciate it!