I'm having trouble adding one year to a database query I have.

while($r = mysql_fetch_assoc($sql))
{
	$r['start_date'] = date("jS F Y", $r['start_date']);
	$r['expiry_date'] = "?";
}

My start_date is stored in a unix timestamp, just wanted to know how can I have the expiry date equal to the start date but with adding 1 year to it.

    Ok the below code seems to be working fine, just for anyone else who has this problem. Use something like this.

    while($r = mysql_fetch_assoc($sql))
    {
    	$r['start_date'] = date("jS F Y", $r['start_date']);
    	$r['expiry_date'] = date("jS F Y", strtotime($r['start_date'].' + 1 year'));
    }
      Write a Reply...