Re: Week Days

From: Date: Fri, 19 Aug 2005 15:17:07 +0000
Subject: Re: Week Days
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-220959@lists.php.net to get a copy of this message
Yo, All you need is the mktime() command. do something like: $futureDate = date("Y-m-d", mktime(0, 0, 0, $month, $today+$daysToAdd, $year)); Jordan http://www.php.net/mktime mktime() is useful for doing date arithmetic and validation, as it will automatically calculate the correct value for out-of-range input. For example, each of the following lines produces the string "Jan-01-1998". <?php echo date("M-d-Y", mktime(0, 0, 0, 12, 32, 1997)); echo date("M-d-Y", mktime(0, 0, 0, 13, 1, 1997)); echo date("M-d-Y", mktime(0, 0, 0, 1, 1, 1998)); echo date("M-d-Y", mktime(0, 0, 0, 1, 1, 98)); ?> On Aug 19, 2005, at 12:57 AM, benc11@gmail.com wrote:
I am trying to add 3 (or a user-defined amount) week days to a certain date.. An example is today 2005-08-18 then adding 3 week days to give me a date of 2005-08-23. I have tried searching online but cannot find an easy way of doing so.


« previous php.general (#220959) next »