PHP获取时间总结

  • 查询前一年时间戳

mktime(0,0,0,date('m'),date('d'),date('Y')-1);
strtotime('-12 month');
  • 查询前6个月时间戳

mktime(0,0,0,date('m')-6,date('d'),date('Y'));
strtotime('-6 month');
  •  格式化时间时间戳

date('Y-m-d H:i:s',time());
原文地址:https://www.cnblogs.com/wanghaokun/p/10275817.html