View Single Post
  #5 (permalink)  
Old 12-04-2006, 12:18 PM
Chan Chan is offline
Programming Professional
 
Join Date: Jun 2006
Posts: 205
Rep Power: 10
Chan is on a distinguished road
Default

Thank you for your input! I actually "borrowed" the code from the community project Weekly Stats:

PHP Code:
// Variables
$current_date time();

// Get day of the week
$current_day dayofweek();

// Find last Monday
$last_monday mktime(0,0,0date("m"$current_date), date("d"$current_date)-($current_day-1), date("Y"$current_date)); 
And the day function:
PHP Code:
/**********************************************************
* Function retuns the day of the week as an integer.
* Used to find the last Monday
**********************************************************/
function dayofweek()
{
        
$days = array("Mon""Tue""Wed""Thu""Fri""Sat""Sun");
        return 
array_search(date("D"), $days) + 1;

Thanks!
Reply With Quote

Sponsored Links