2010-09-28 4 views
1

J'ai une date où je dois ajouter mois à, mais en quelque sorte, il renvoie la date d'époqueAjouter des mois à une date existante?

$duration = 28; 
$row['end_date'] = '2010-09-22 0000:00:00'; 

$newEndDate = date("Y-m-d", strtotime(" +".$duration." month",substr($row['end_date'],0,10))); 

Répondre

3
$newEndDate = strtotime(date("Y-m-d", strtotime($date)) . " +1 month"); 
2

Utilisez ce lieu:

$date = date("Y-m-d");// current date 

$date = strtotime(date("Y-m-d", strtotime($date)) . " +1 day"); 
$date = strtotime(date("Y-m-d", strtotime($date)) . " +1 week"); 
$date = strtotime(date("Y-m-d", strtotime($date)) . " +2 week"); 
$date = strtotime(date("Y-m-d", strtotime($date)) . " +1 month"); 
$date = strtotime(date("Y-m-d", strtotime($date)) . " +30 days"); 
Questions connexes