note 80826 deleted from function.mktime by danbrown

From: Date: Sun, 20 Jul 2008 03:31:12 +0000
Subject: note 80826 deleted from function.mktime by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-142069@lists.php.net to get a copy of this message
Note Submitter: admin at aflog dot org ---- Heres a way to get the UNIX timestamp for the first day of this week: <?php $week = mktime(0, 0, 0, date("n"), date("j"), date("Y")) - (date("N")*3600*24); echo date("l jS F, Y @ H:i:s a", $week); ?> In my case this outputted: Sunday 27th January, 2008 @ 00:00:00 am (and today is Saturday 2nd February, 2008 @ 16:59:41 pm) This is useful for (what i am doing which is) site stats pages. Can be used to give your mysql query a cut off date for example, for all the visitors this week, or how many posts this week or whatever it may be xjden

« previous php.notes (#142069) next »