Look into DAYOFYEAR on www.mysql.com.  I think you can develope a SELECT
statement to do what you need.  Might get more help on the PHP-DB list.
Good luck.

----- Original Message -----
From: "Sascha Braun" <[EMAIL PROTECTED]>
Sent: Tuesday, October 01, 2002 3:26 PM
Subject: [PHP] Date Arithmetic

I have a small but hard to solve problem to solve.

Wrote a Select Query for my webpage.

The query should select all values which where
written into the DB the last seven Days.

I thought everything was working fine, but now
the month has changed and everything went

My Select Query is not able to go into the Last
month in calculation.

I don't really know how to manage this problem.

Please Help

Here is the Query:

$Query = "SELECT * FROM bild_db WHERE datum > '".date('Y') . '-' . date('m')
. '-' . (date('d') - $_REQUEST['days']) . ' 00:00:00'."'";

Another code snipped:

<? echo date('Y') . '-' . date('m') . '-' . (date('d') - 7); ?>

The code will work fine as long you are not at the beginning
of the month. Or in the first six days.

Good luck


PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to