note 74148 deleted from function.date by bobby

From: Date: Tue, 27 Mar 2007 21:00:56 +0000
Subject: note 74148 deleted from function.date by bobby
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-124856@lists.php.net to get a copy of this message
Note Submitter: chazarra dot clement at gmail dot com ---- Hello, I have been searching for while about getting the last monday date of any date. Many solutions too complicated and so I finally get my own inspired from different codes: $date=("2007-03-15"); $tab_date = explode ('-',$date); $current_date = mktime(0,0,0,$tab_date[1],$tab_date[2],$tab_date[0]); $date_num = date("w",$current_date); $date_num --; $monday = mktime(0,0,0,$tab_date[1],$tab_date[2]-$date_num,$tab_date[0]); echo date("Y-m-d",$monday); Nothing much for most of you, but I spend some hours to get to this result..

« previous php.notes (#124856) next »