Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Diiference in date -- from Access

Status
Not open for further replies.

SSonnier

Technical User
Nov 4, 2003
78
US
Here is whaw I'm trying to do:

I am trying to calculate the difference in years between today's date and a date(year) that I am storing in a database.

How can I pull the year form the query into the datediff function?

Here is the code: The second specifier is causing problems "(#ayear#)"

<cfoutput query="emplist2">
#first_name#'s &nbsp;&nbsp;- &nbsp;&nbsp; #datediff("yyyy",now(), (#ayear#))# Years
</cfoutput>
 
According to the CF Help files, DateDiff "Determines the number of units by which date1 is less than date2."

datediff("datepart", "date1", "date2")

So, in your code is the value "ayear" going to be greater than Now()? If not, you'll need to switch them. If it's right, try this:

#datediff("yyyy",#Year(now())#,#ayear#)#





Hope This Helps!

Ecobb

&quot;My work is a game, a very serious game.&quot; - M.C. Escher
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top