[thelist] Displaying info according to date

Ken Schaefer ken at adOpenStatic.com
Thu Jun 26 02:36:58 CDT 2003


Most databases have an inbuilt function to return the current date.

eg for Access:

SELECT field1, field2, field3 FROM myTable WHERE myDateField <= Date()

eg for SQL Server

-- you could use CONVERT() if you wanted to drop the minutes part
SELECT field1, field2, field3 FROM myTable WHERE myDateField <= GetDate()

No need to supply anything from your script.

Cheers
Ken

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Andre Genic" <g3nic at lycos.co.uk>
Subject: [thelist] Displaying info according to date


: Hi boys and girls, I've been trying to work on something, basically cos I
: don't know how to do it, so I thought a few days of messing around might
: lead to something productive, alas it didn't.
:
: What I'm trying to do, is add information to a table and then retrieve
: everything up to a date point, I've tried a few things like using $now =
: $date and using a formatted date in the sql query, but no luck, I'm
storing
: dates like this $date = date("M jS Y"); you probably get the idea.
:
: $date = date("M jS Y");
:
: $now = $date
:
: $sql = "SELECT * FROM table WHERE $ddate = -->$now"; just a basic idea...
:
: Putting the information in is no problem, it's just the retrieval, what
I'm
: trying to achieve is being able to add stuff to a site a few days in
advance
: or a week in advance, then when the right day comes along, everything in
the
: table gets displayed up to todays date etc, apart from the stuff that
hasn't
: reached it's due date.
:
: Hope you can understand what I mean, cos I'm starting to lose the plot
with
: this one.
:
: Andre.
:
: -- 
: * * Please support the community that supports you.  * *
: http://evolt.org/help_support_evolt/
:
: Evolt.org conference in London, July 25-27 2003.  Register today at
http://evolt.org.uk
:
: For unsubscribe and other options, including the Tip Harvester
: and archives of thelist go to: http://lists.evolt.org
: Workers of the Web, evolt !



More information about the thelist mailing list