PHP函数strtotime的扩展,针对函数strtotime +月时候的BUG做到扩展!
function add_month ( $base_time = null, $months = 1 ) { if ( is_null ( $base_time ) ) $base_time = time(); $x_months_to_the_future = strtotime ( "+" . $months . " months", $base_time ); $month_before = ( int ) date ( "m", $base_time ) + 12 * ( int ) date ( "Y", $base_time ); $month_after = ( int ) date ( "m", $x_months_to_the_future ) + 12 * ( int ) date ( "Y", $x_months_to_the_future ); if ( $month_after > $months + $month_before ) { $x_months_to_the_future = strtotime ( date ( "Ym01His", $x_months_to_the_future ) . " -1 day" ); } return $x_months_to_the_future; }
以上就是PHP函数strtotime的扩展的内容,更多相关内容请关注PHP中文网(www.php.cn)!
陳述
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn

熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

AI Hentai Generator
免費產生 AI 無盡。

熱門文章
刺客信條陰影:貝殼謎語解決方案
3 週前ByDDD
Windows 11 KB5054979中的新功能以及如何解決更新問題
2 週前ByDDD
在哪裡可以找到原子中的起重機控制鑰匙卡
3 週前ByDDD
節省R.E.P.O.解釋(並保存文件)
1 個月前By尊渡假赌尊渡假赌尊渡假赌
刺客信條陰影 - 如何找到鐵匠,解鎖武器和裝甲定制
4 週前ByDDD

熱工具

記事本++7.3.1
好用且免費的程式碼編輯器

SublimeText3 Mac版
神級程式碼編輯軟體(SublimeText3)

Dreamweaver Mac版
視覺化網頁開發工具

WebStorm Mac版
好用的JavaScript開發工具

禪工作室 13.0.1
強大的PHP整合開發環境