note 43599 added to function.strtotime

From: Date: Sun, 27 Jun 2004 15:06:21 +0000
Subject: note 43599 added to function.strtotime
Groups: php.notes 
Request: Send a blank email to php-notes+get-71934@lists.php.net to get a copy of this message
I believe these functions can be "stacked" to produce some quite useful results. For example, the following code gives you the last Monday in August (a UK bank holiday) <?php $LastMondayAugust = strtotime("-1 week monday", strtotime("1 september 2004")) + 43200; ?> "-1 week" gives you the week before 1 september "monday" increases the day until it's a monday 43200 is 12 hours in seconds (if you use dates at midnight, a timezone change will occasionally put you one hour into the wrong day) ---- Manual Page -- http://www.php.net/manual/en/function.strtotime.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+43599 Delete -- http://master.php.net/manage/user-notes.php?action=delete+43599&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+43599&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#71934) next »