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!

between dates query

Status
Not open for further replies.

derwent

Programmer
Joined
May 5, 2004
Messages
428
Location
GB
I have a DB with displayfrom and displayto date fields. I need to return the data if todays date is between the from and to dates, i.e. only when it should be displayed on the website.

Can someone help with the sql, I'm trying to gather something like

select * from mytable where vartodaysdate between displayfrom and displayto
 
just to add, I am setting the date to be UK and setting shortdate

<%
session.lcid=2057
vartodaysdate = (FormatDateTime(date(),vbshortdate))
%>

to output 24/04/2006 as this is the format of the dates in the MSSQL DB.

So if the DB has a record with displayfrom as 20/04/2006 and displayto as 30/04/2006 it will out put those records only.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top