note 77967 deleted from function.date by derick

From: Date: Sun, 09 Dec 2007 13:39:43 +0000
Subject: note 77967 deleted from function.date by derick
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-133006@lists.php.net to get a copy of this message
Note Submitter: sheldon at gozipline dot com ---- I have to work out the day before an event to send an email notification. But if the day before was on a weekend I had to make sure the email was send on the Friday before the weekend. I didn't see anything like this around so here is what i wrote. Hope it helps some one else. <?php $dates = explode("/", "09/22/2007"); $month = $dates['0']; $day = $dates['1']; $year = $dates['2']; $yesterday = mktime(0,0,0,$month,$day-1,$year); $notification = date('l',$yesterday); if(in_array($notification, array("Saturday", "Sunday"))){ $notification = "Friday"; } echo("<p>{$notification}</p>"); ?>

« previous php.notes (#133006) next »