Edit report at https://bugs.php.net/bug.php?id=60980&edit=1
ID: 60980 Updated by: der...@php.net Reported by: moh dot e at live dot com Summary: date with strtotime -Status: Open +Status: Not a bug Type: Bug Package: Date/time related Operating System: debian PHP Version: 5.3.10 Block user comment: N Private report: N New Comment: Please do not submit the same bug more than once. An existing bug report already describes this very problem. Even if you feel that your issue is somewhat different, the resolution is likely to be the same. Thank you for your interest in PHP. There are numerous occasions of this "non bug" in the database. This is not a bug: http://derickrethans.nl/obtaining-the-next-month-in-php.html Previous Comments: ------------------------------------------------------------------------ [2012-02-05 18:29:48] moh dot e at live dot com Description: ------------ I used this function as below but i have problem in February month if 'user_invoice_date' equal 2012-01-30 or 2012-01-31 the 'new_invoice_date' equal 2012-03-01 $new_invoice_date=date("Y-m-01 H:i:s",strtotime($user_invoice_date."+1 month")); Test script: --------------- normal $user_invoice_date="2011-12-31"; $new_invoice_date=date("Y-m-01 H:i:s",strtotime($user_invoice_date."+1 month")); //////////////// Error $user_invoice_date="2012-01-31"; $new_invoice_date=date("Y-m-01 H:i:s",strtotime($user_invoice_date."+1 month")); echo $new_invoice_date; Expected result: ---------------- $user_invoice_date="2012-01-31"; $new_invoice_date=date("Y-m-01 H:i:s",strtotime($user_invoice_date."+1 month")); $new_invoice_date=2012-02-01 2012-02-01 Actual result: -------------- $new_invoice_date=2012-03-01 2012-03-01 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=60980&edit=1