php獲取指定月的 起止時間戳

  1. $Y = 2016;//獲取年,示例,真實環境從前端獲取數據  
  2. $m = 8;//獲取月,示例,真實環境從前端獲取數據  
  3. $month = $Y."-".$m;//當前年月  
  4. $month_start = strtotime($month);//指定月份月初時間戳  
  5. $month_end = mktime(23, 59, 59, date('m'strtotime($month))+1, 00);//指定月份月末時間戳  
  6. //dump(array("month"=>$month,"month_start"=>$month_start,"month_end"=>$month_end));//輸出  
發佈了37 篇原創文章 · 獲贊 6 · 訪問量 12萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章