|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
Patchesdat-time-problem (last revision 2012-02-05 18:32 UTC by moh dot e at live dot com)Pull RequestsHistoryAllCommentsChangesGit/SVN commits
[2012-02-05 18:32 UTC] derick@php.net
[2012-02-05 18:32 UTC] derick@php.net
-Status: Open
+Status: Not a bug
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 05:00:01 2025 UTC |
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