Re: [PHP] incrementing a date!

2001-02-25 Thread Philip Olson


> ex: 2001-03-28 'll become 2001-04-01

Here's an example (a hack) which may help you get going :


 print getFutureDate('2001-03-28',4); // 2001-04-01

 function getFutureDate($date,$days,$format='Y-m-d')
 {
 list($year,$month,$day) = explode('-', $date);

 $timestamp = mktime(0,0,0, $month, $day, $year); 

 $secs = ($days * 86400);

 return date($format,$timestamp+$secs);
 }


Regards,


Philip Olson
http://www.cornado.com/

On Sun, 25 Feb 2001, kaab kaoutar wrote:

> Hi all!
> s there a way with which we can increment a date (by day) without extracting 
> the month the day and the year then increment some of them depending on the 
> day the month and the year ?
> ex: 2001-03-28 'll become 2001-04-01
> 
> Thanks
> _
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] incrementing a date!

2001-02-25 Thread Web Admin

hi,
try $tomorrow  = mktime(0,0,0,date("m")  ,date("d")+1,date("Y"));
or maybe better than this, if you convert the date to the standard
unix timestamp and use DATE function.
Best of luck,
Ahmad Anvari
  - Original Message - 
  From: kaab kaoutar 
  To: [EMAIL PROTECTED] 
  Sent: Sunday, February 25, 2001 2:36 PM
  Subject: [PHP] incrementing a date!


  Hi all!
  s there a way with which we can increment a date (by day) without extracting 
  the month the day and the year then increment some of them depending on the 
  day the month and the year ?
  ex: 2001-03-28 'll become 2001-04-01

  Thanks
  _
  Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.


  -- 
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]





[PHP] incrementing a date!

2001-02-25 Thread kaab kaoutar

Hi all!
s there a way with which we can increment a date (by day) without extracting 
the month the day and the year then increment some of them depending on the 
day the month and the year ?
ex: 2001-03-28 'll become 2001-04-01

Thanks
_
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]