[英]Version difference for strtotime('first day of last month')?
在包含的腳本中
date('Y-m-d', strtotime('first day of last month'))
在版本5.3.10(localhost)中,我得到了例如'2012-03-01'。
在版本5.2.17(遠程主機)中我得到'1969-12-31'。
是否有表達式會返回兩個版本的預期結果(例如,'2012-03-01')?
date('Y-m-d', strtotime('first day of -1 month'))
適用於PHP 7.0
這是PHP 5.2.17中的一個已知錯誤
很簡單:
date('Y-m-01')
任何月份的第一天總是1。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.