Administration variable

For a administration section I need to set variables like $begin_of_week, end_of_week, $begin_of_month, $end_of_month etc, which I can use in different queries based on my server time which in in the Netherlands. For example the begin of the week should be monday 00.00 AM and the end of the week sunday 00.00 AM.

It don’t have to be a given week or month, but just in general

So what exactly is your question?

As cpradio said, your question isn’t really clear. But, you could read the official manual on functions about dates: http://www.php.net/manual/en/ref.datetime.php

On a weekly, monthly, quarter, yearly basis I need to be able to run a query for sales made by a marketeer, Not only for the manager, but for every individual marketeer self as well i.e.


SELECT SUM(aantal) FROM marketeers WHERE marketeer_id = $marketeer_id AND DATE(myDate) BETWEEN $begin_of_week AND $end_of_week

So by default it should not mather which week, month, quarter, from which year it is but the posibility should be available true a select box

So your issue is $begin_of_week $end_of_week are not actual dates, but just the times and you need to compare them to an actual date/time. It may be as simple as changing DATE(myDate) to TIME(myDate)

Hi cpradio. Thank you for the reply :slight_smile:

$begin_of_week should be monday 00:00 00:01 AM

and

$end_of_week should be sunday 00:00 00:00 AM