Hi All,
I'm storing timestamp(14) in my database to be used in a query. I want to be able to allow my users to select a query range of (for example)
<select name=qRange>
<option>The Last 1 Day
<option>The Last 7 Days
<option>The Last 30 Days
<option>Week To Date
...etc....
</select>
If for example, the first option is chosen, part of my query will look like this:
$currTime = date("YmdHis");
$offSetTime = ((substr($currTime,6,2)) - 1);
$adjTime = (substr($currTime,0,6)).$offSetTime.(substr($currTime,8,6));
WHERE Entry_Date BETWEEN '$currTime' AND '$adjTime
Entry_Date being the timestamp(14).
This will of course work....unless the current date is 1. How might I compensate for this since different months have different days in them (31,30 and 28 for Feb). I know there is a php function to figure days in a month.
Is there a php function out there, or an easy way to figure this out w/o lots of code?
This question of course then applies to all the select options.
Gary