1. 获取上个月第一天及最后一天.
月初 date ('Y-m-01', strtotime ('-1 month'));
月末 date ('Y-m-t', strtotime ('-1 month'));
上个月第一天:
date ('Y-m-d', strtotime (date ('Y-m-01') . ' -1 month')); // 计算出本月第一天再减一个月
上个月最后一天:
date ('Y-m-d', strtotime (date ('Y-m-01') . ' -1 day')); // 计算出本月第一天再减一天
2. 获取当月第一天及最后一天.
当月月初 date ('Y-m-01', strtotime (date ("Y-m-d")));
当月月末 date ('Y-m-d', strtotime (date ('Y-m-01', strtotime (date ("Y-m-d"))) . "+1 month -1 day"));
3. 获取当天年份、月份、日及天数.
"本月共有:".date ("t");
"当前年份".date ('Y');
"当前月份".date ('m');
"当前几号".date ('d');
4.获取某一天的日期
-
echo date("Y-m-d H:i:s",strtotime("-7 day"));
-
echo date("Y-m-d H:i:s",strtotime("7 day"));
-
//一小时之前的时间
echo strtotime("-1 hours");
//五小时之后的时间
echo strtotime("+5 hours");
//一周之后的时间
echo strtotime("+1 week");
//下周一的时间
echo strtotime("next Monday");
//一周的最后一天,就是周日
echo strtotime("last Sunday");
5.excel表格内时间格式转换时间戳
gmdate('Y-m-d', ($fileData[$i][3] - 25569) * 86400)