calculating age

Results 1 to 2 of 2

Thread: calculating age

  1. #1
    Join Date
    Dec 1969

    Default calculating age

    hi. i have prob in calculating the age.<BR><BR>&#060;%Age = DateDiff("yyyy",objRec("Pat_DOB"),session(year))%& #062;<BR>&#060;% Response.write Age %&#062;<BR><BR>the Pat_DOB (24/7/1980) is read from the database whereas the session(year) is choosen from the drop down menu which only displays year. eg: 1999,2000,2001..etc<BR><BR>the ouput shows the age is -75<BR>is there a problem with the session(year) ? do i need to include the date and month? plizz help<BR>or is there any other method of calculating the age&#062;?<BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: calculating age

    DATEDIFF(yyyy,session("year"),objRec("Pat_DOB"))<B R><BR>so put quotes around the year in session(year) and loose the quotes around yyyy. Also, not to get negative ages swith the dates. Works for me....

Posting Permissions

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