troubleshooting Question

Year between 2 Years

Avatar of cpwilson
cpwilson asked on
ColdFusion Language
3 Comments1 Solution374 ViewsLast Modified:
<select name='search_age' size='1'>
	<option value="" selected></option>
	<option value='<cfoutput>#year(now())-1#</cfoutput>'>Kids</option>
	<option value='<cfoutput>#year(now())-13#</cfoutput>'>Teens</option>
	<option value='<cfoutput>#year(now())-20#</cfoutput>'>Twenties</option>
	<option value='<cfoutput>#year(now())-30#</cfoutput>'>Thirties</option>
	<option value='<cfoutput>#year(now())-40#</cfoutput>'>Forties</option>
	<option value='<cfoutput>#year(now())-50#</cfoutput>'>Fifties</option>
	<option value='<cfoutput>#year(now())-60#</cfoutput>'>Sixties</option>
	<option value='<cfoutput>#year(now())-70#</cfoutput>'>Seventies</option>
search variable is shown as follows

<cfif search_age is not "">
	and yob BETWEEN year(now()) and #search_age#

Can anyone help with code to determine if a particular year falls between 2 years? I want to search based on a year field stored in the database (as numeric field) to determine if it is between a generated year (selected as year(now)-13, 20, 30, etc) and today's date. If it is then it should show all records that are between the 2 dates

Search year is taken from a select tag

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros