WCM Forum

WCM Forum (http://www.wcm.at/forum/index.php)
-   Programmierung (http://www.wcm.at/forum/forumdisplay.php?f=17)
-   -   php zeitraum mit uhrzeit berechnen (http://www.wcm.at/forum/showthread.php?t=130199)

reichr 02.04.2004 08:07

php zeitraum mit uhrzeit berechnen
 
hallo!


folgendes sql statement:

PHP-Code:

select from $tb_look where time = ???? 

möchte nun folgenden zeitraum berechnen:
heute (donnerstag) -> also jeden donnerstag wird das script ausgeführt um 12:00 Uhr

zeitraum:
er soll alles abfragen was zwischen heute (donnerstag) <= 12:00 und letzten donnerstag > 12:00 liegt

wie schaff ich dass am besten?

PHP-Code:

.date("d.m.Y, H:i",$look[time]+$time_offset). 


heli2sky 02.04.2004 18:50

PHP-Code:

$now mktime(12,0,0,date("m"),date("d"),date("Y")); // heute 12:00
$then_tmp $today-3600*24*7// 7 tage früher (zeitumstellung wird zb. nicht beachtet)
$then mktime(12,0,0,date("m",$then_tmp),date("d",$then_tmp),date("Y",$then_tmp)); // 7 tage früher, aber genau um 12:00

...

mysql_query("SELECT * FROM $tb_book WHERE time > '$then' AND time < '$now'"); 

wennst es nicht mit timestamps machst, fällt halt das mktime weg und du machst das gleich mit date("d.m.Y - 12:00",$then_tmp) - is aber vom prinzip das gleiche...

PS: nicht getestet


Alle Zeitangaben in WEZ +2. Es ist jetzt 15:58 Uhr.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
© 2009 FSL Verlag