[SOLVED] Date calculating problems
Posted: Thu Jul 29, 2004 5:08 am
Hi there,
maybe it's the same thing as with my last posting and i just have been coding too long to see the (simple) solution... anyway, here's the problem:
As a part of our CMS, we have an event database which stores the 'general event information', information about the people involved and additional information about where the event is taking place. Now i have to code a script which should extract the event dates from the current and from the next three calendar weeks.
With this, the script knows the current calendar week (31), and i can raise this number to fit my needs - BUT: I need the exact date of each Monday (i. e. 2004-07-26) and each Friday (i. e. 2004-07-30) of the specified calendar week to extract the information from the db tables with a query like this:
.
Does anyone have a function for this, or a simple trick to do? It would be a live-saving tip!
Greez,
- bluenote
maybe it's the same thing as with my last posting and i just have been coding too long to see the (simple) solution... anyway, here's the problem:
As a part of our CMS, we have an event database which stores the 'general event information', information about the people involved and additional information about where the event is taking place. Now i have to code a script which should extract the event dates from the current and from the next three calendar weeks.
Code: Select all
<?php
$calendar_week = date("W");
global $calendar_week;
?>Code: Select all
<?php
function getCWstartDate ($my problem) {
...
...
return $CWstartDate}
function getCWendDate ($my problem too) {
...
...
return $CWendDate}
$cwMonday = substr($CWstartDate, 8, 2);
$cwFriday = substr($CWendDate, 8, 2);
$cwMonth = substr($CWstartDate, 5, 2);
$cwYear = substr($CWstartDate, 0, 4);
SELECT CONCAT(events.day,'.',events.month,'.',events.year) AS date, events.time, events.location, events.mail INTO OUTFILE "/usr/local/Web/shared/tmp/kw_1.txt" FIELDS TERMINATED BY ';' LINES TERMINATED BY "\n" FROM events WHERE events.day BETWEEN '$cwMonday' AND '$cwFriday' AND events.month = '$cwMonth' AND events.year = '$cwYear' AND (events.location != '' AND events.location != '0') ORDER BY events.time ASC
?>Does anyone have a function for this, or a simple trick to do? It would be a live-saving tip!
Greez,
- bluenote