php如何实现时间转换?(时间戳)

2025年02月12日 建站教程

php如何获取各种时间转换成各种时间戳?下面web建站小编给大家简单介绍以下各种时间的转换!

具体实现代码如下:

获取今天日期

date("Y-m-d",strtotime("today")); 

获取昨天日期

date("Y-m-d",strtotime("yesterday"));

获取明天日期

date("Y-m-d",strtotime("tomorrow ")); 

获取今天日期

date("Y-m-d",strtotime("today")); 

获取7天后日期

date("Y-m-d",strtotime("+7 day")); 

获取一周后日期

date("Y-m-d",strtotime("+1 week")); 

获取30天后日期

date("Y-m-d",strtotime("+30 day")); 

获取一个月后日期

date("Y-m-d",strtotime("+1 month")); 

获取一个月前日期

date("Y-m-d",strtotime("-1 month")); 

获取一年后日期

date("Y-m-d",strtotime("+1 year")); 

php获取下个星期五日期

date("Y-m-d",strtotime("next Friday"));

本文链接:http://so.lmcjl.com/news/23019/

展开阅读全文
相关内容