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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

date + 7 days....please help

Status
Not open for further replies.

imstillatwork

IS-IT--Management
Joined
Sep 26, 2001
Messages
1,605
Location
US
I have a date in my database:
I need two things:

1.) To be able to SELECT dates in the database, ignoring the YEAR. I give day and month, I want all records matching, regardless of year.

2.) To be able to SELECT by todays date, and get every record for today (again, ignoring the year) and 7 days ahead.

If todays date is 5/5, I want to SELECT records from 5/5 to 5/12
but what happens if I today is 5/24? I want dates 5/24 to 6/2. make sense?

any ideas? i know it isnt that hard for you guys!
 
I know haow the BETWEEN statment works. I need to know how to format my dates to get the following 7 days...
thanks
 
This seems to work. I seem to be talking to myself. OK, If anyone want to try this, let me know how it does. a few requirments....
dates must stored in as varchar in m/d/yyy NOT mm/dd/yy format.

<cfset date1 = dateformat(now(), &quot;m/d&quot;)>
<cfset date2 = dateformat(dateadd(&quot;d&quot;, 7, date1), &quot;m/d&quot;)>

<cfquery name=&quot;getall&quot; datasource=&quot;test&quot;>
SELECT * FROM tblDATE
WHERE datein BETWEEN '#date1#%' AND '#date2#%'
</cfquery>

<cfoutput query=&quot;getAll&quot;>
Name: #name#, DOB: #DateIN#<br><br>
</cfoutput>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top