Car CD players | Debt Consolidation | Mortgage | Credit Card | Remortgage
ASP - Time and Date comparisons [Archive] - PCMech Forums

PDA

View Full Version : ASP - Time and Date comparisons


artsapimp
12-07-2000, 09:57 AM
I am building a calendar and have ideas that I don't know how to build. I have the basic functionality pulling from a database and so on to make the calendar work. What I want to do is make the home page automatically pull up the next 4 hours of schedules and display them on the page. I'm sure there is something that compares Now to the database, but I don't know how to do it. Please assist with that if you can. Thanks.

UncaDanno
12-07-2000, 02:32 PM
You using SQL Server or Access?

artsapimp
12-08-2000, 09:39 AM
It's Access 2000.

UncaDanno
12-13-2000, 12:53 PM
Try this....

WHERE datediff("h",now(),whatever_the_date_column_is) between 0 and 4

This will select rows where whatever_the_date_column_is is 0 to 4 hours in the future. You can swap the date fields to select rows where the date is 0 to 4 hours in the past.

artsapimp
12-13-2000, 03:11 PM
Thanks.