View Single Post
  #4 (permalink)  
Old 11-30-2006, 01:38 PM
awgeorge awgeorge is offline
Newbie
 
Join Date: Nov 2006
Age: 17
Posts: 1
Rep Power: 0
awgeorge is on a distinguished road
Default There is a better way

Hi, instead of using (-2) you can atually use words if you wanted the last monday, all you would have to do is put "Last Monday":

Like this

PHP Code:
$monday date('m/d/Y'strtotime('last monday'));  //last moday
$tuesday date('m/d/Y'strtotime('last tuesday')); 
$wednesday date('m/d/Y'strtotime('last wednesday')); 
$thursday date('m/d/Y'strtotime('last thursday')); 
$friday date('m/d/Y'strtotime('last friday')); // last friday

// Then all you would do is echo it.

echo $monday;

// and so on 
You can also put times into it like this

PHP Code:
$when 'next thursday'// what date its aming for
$sethour '12'// Set hour
$setminute '30'// Set minutes
$hourminus2 $sethour-2// For the strotime function

$deadline strtotime("".$when." at ".$hourminus2.":".$setminute.""); // set a deadline

print strftime('%c',$deadline) ; 
it displays Thu Nov 30 12:30:00 2006 but because of some php errors you have to minus 2 hours. so thats what i have done above.

Will George

Last edited by awgeorge; 11-30-2006 at 01:44 PM.
Reply With Quote