Re: date() and mktime() functions: weeknumbers and months.

From: Date: Mon, 31 Mar 2003 14:36:03 +0000
Subject: Re: date() and mktime() functions: weeknumbers and months.
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-141694@lists.php.net to get a copy of this message
On Monday 31 March 2003 22:07, Davy Obdam wrote: > I would like to select news from my database bases on week/year and > month/year. > How can i do this.. I would like to pass two arguments in the query > string, like news.php?week=14&year=2003 or news.php?month=3&year=2003. > Can anybody help me.. Thanks in advance. I have been looking at the > date() and mktime() functions, but is there anyway to determine the date > from a weeknumber? I have been using this: [snip] > $sql = "SELECT * FROM news WHERE date>='$last_sunday' AND > date<='$next_saturday'). > > But i would find it better to use a weeknumber instead If you're using mysql you can do something like: SELECT * FROM news WHERE WEEK(date) = some_week_number_or_another If you're using some other DBMS check whether it has some similar function. -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * ------------------------------------------ Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general ------------------------------------------ /* We can predict everything, except the future. */

« previous php.general (#141694) next »