date时间大全
<?php
echo "今天:".date("Y-m-d")."<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", time()-24*60*60);
echo "<br>";
#前天
echo date("Y/m/d h:i:s", time()-2*24*60*60);
date("Y/m/d H:i:s", strtotime("1 days ago"));
date("Y/m/d H:i:s", strtotime("2 days ago"));
date("Y/m/d H:i:s", mktime(0, 0, 0, date("m"), date("d")-1, date("Y")));
$time_yes = localtime(time()-24*60*60, true);
$time_b_yes = localtime(time()-2*24*60*60, true);
$yesterday = $time_yes['tm_mday'];
$the_day_before_yes = $time_b_yes['tm_mday'];
//昨天
print date('Y-m-d', strtotime('-1 day'));
//上星期
print date('Y-m-d', strtotime('-1 week'));
//上个月
print date('Y-m-d', strtotime('-1 month'));
//去年
print date('Y-m-d', strtotime('-1 year'));
//strtotime得到一个时间戳, 然后你自己格式化.
strtotime('yesterday');
strtotime('-2 day');
网友回复
有没有免费让ai自动帮你接管操作电脑的mcp服务?
mcp为啥用Streamable HTTP 替代 HTTP + SSE?
scratchjr有没有开源的前端html网页版本源代码?
多模态大模型能否根据ui交互视频来来模仿写出前端交互动画效果ui代码?
如何用阿里云oss+函数计算fc+事件总线EventBridge+消息队列+数据库+redis缓存打造一个高并发弹性系统?
阿里云函数计算 FC如何在海外节点搭建一个代理网络?
ai studio中gemini build的代码如何发布到github pages等免费网页托管上 ?
如何在cursor、qoder、trae中使用Claude Skills功能?
有没有不用u盘就能重装系统的开源工具?
python如何固定摄像头实时计算停车场停车位剩余数量?


