ivytony Posted March 9, 2008 Share Posted March 9, 2008 Say, I want to get the period range for this week or this month and today is Saturday, Mar 08, 2008. The output of the period needs to be in timestamp format: $daystart = mktime (0, 0, 0, $start_month, $start_day, $start_year); //get timestamp for the start of the range $dayend= mktime (0, 0, 0, $end_month, $end_day, $end_year); //get timestamp for the end of the range This range (start & end date) will be used for a mysql query that retrieves transactions that were completed in the selected range. The time of the transaction in database is in unix timestamp format, e.g. 1203557592 (if converted to readable date, this is February 20 2008 05:33:12 PM) I appreciate your help!! Quote Link to comment Share on other sites More sharing options...
chronister Posted March 9, 2008 Share Posted March 9, 2008 <?php $todayStart = mktime(0,0,0,date('m'),date('d'),date('y')); $todayEnd = mktime(23,59,59,date('m'),date('d'),date('y')); echo 'Start of today was at '. date('h:i:s',$todayStart); echo '<br>'; echo 'End of today was at '. date('h:i:s';, $todayEnd); ?> Take a look at the manual, you can build these time strings any way you want. Using a combo of date() & mktime(). You can generate a timestamp for any period you want. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.