note 80826 added to function.mktime

From: Date: Sat, 02 Feb 2008 04:01:07 +0000
Subject: note 80826 added to function.mktime
Groups: php.notes 
Request: Send a blank email to php-notes+get-135721@lists.php.net to get a copy of this message
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 ---- Server IP: 202.89.58.1 Probable Submitter: 125.239.90.222 ---- Manual Page -- http://www.php.net/manual/en/function.mktime.php Edit -- https://master.php.net/note/edit/80826 Del: integrated -- https://master.php.net/note/delete/80826/integrated Del: useless -- https://master.php.net/note/delete/80826/useless Del: bad code -- https://master.php.net/note/delete/80826/bad+code Del: spam -- https://master.php.net/note/delete/80826/spam Del: non-english -- https://master.php.net/note/delete/80826/non-english Del: in docs -- https://master.php.net/note/delete/80826/in+docs Del: other reasons-- https://master.php.net/note/delete/80826 Reject -- https://master.php.net/note/reject/80826 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#135721) next »