date_default_timezone_set('PRC'); //默认时区
echo "今天:",date("Y-m-d",time()),"<br>";
echo "今天:",date("Y-m-d",strtotime("18 june 2008")),"<br>";
echo "昨天:",date("Y-m-d",strtotime("-1 day")),"<br>";
echo "明天:",date("Y-m-d",strtotime("+1 day")),"<br>";
echo "一周后:",date("Y-m-d",strtotime("+1 week")),"<br>";
echo "一周零两天四小时两秒后:",date("Y-m-d G:H:s",strtotime("+1 week 2 days 4 hours 2 seconds")), "<br>";
echo "下个星期四:",date("Y-m-d",strtotime("next Thursday")),"<br>";
echo "上个周一:".date("Y-m-d",strtotime("last Monday"))."<br>";
echo "一个月前:".date("Y-m-d",strtotime("last month"))."<br>";
echo "一个月后:".date("Y-m-d",strtotime("+1 month"))."<br>";
echo "十年后:".date("Y-m-d",strtotime("+10 year"))."<br>";
echo "今天:",date('Y-m-d H:i:s'),"<br>";//输出当前时间
echo "明天:",date('Y-m-d H:i:s',strtotime('+1 day'));//输出明天时间
//这里+1 day 可以修改参数1为任何想需要的数 day也可以改成year(年),month(月),hour(小时),minute(分),second(秒)
//如:
date('Y-m-d H:i:s',strtotime("+1 day +1 hour +1 minute");
//1、给定一个日期,获取其本月的第一天和最后一天
function getCurMonthFirstDay($date) {
return date('Y-m-01', strtotime($date));
}
function getCurMonthLastDay($date) {
return date('Y-m-d', strtotime(date('Y-m-01', strtotime($date)) . ' +1 month -1 day'));
}
//2、给定一个日期,获取下月的第一天和最后一天
function getNextMonthFirstDay($date) {
return date('Y-m-d', strtotime(date('Y-m-01', strtotime($date)) . ' +1 month'));
}
function getNextMonthLastDay($date) {
return date('Y-m-d', strtotime(date('Y-m-01', strtotime($date)) . ' +2 month -1 day'));
}
//3、给定一个日期,获取其上月的第一天和最后一天
function getPrevMonthFirstDay($date) {
return date('Y-m-d', strtotime(date('Y-m-01', strtotime($date)) . ' -1 month'));
}
function getPrevMonthLastDay($date) {
return date('Y-m-d', strtotime(date('Y-m-01', strtotime($date)) . ' -1 day'));
}
$timeout_date = date('Y-m-d H:i:s', strtotime(date('Y-m-d H:i:s', strtotime($extend->updated_at)) . "+$extend->left_send_good_day day +$extend->left_send_good_hour hour +$extend->left_send_good_min minute"));