| Posted by NC on 04/12/06 19:14 
Martin Wright wrote:>
 > I hope someone can help or point me in the right direction.  I am new to PHP
 > and I am trying to pick up a DATE type field in a mysql_query Select
 > statement, bring it into php add a number of days to this date and inert a
 > new record with the new date.
 >
 > The item that appears to be assigned to the php variable appears to be a
 > string 2006-04-11.
 
 But of course it is.  Here's what you need to do:
 
 $old_date = '2006-04-11';
 $days_to_add = 3;
 $new_date = date('Y-m-d', strtotime($old_date) + $days_to_add * 60 * 60
 * 24);
 
 Now $new_date is ready for insertion.
 
 Cheers,
 NC
 [Back to original message] |