php返回日期的实例(明天的日期、今天的日期、昨天的日期)
发布时间:2016-06-12 编辑:jiaochengji.com
本文介绍下,php返回日期的几个例子,分别是返回明天的日期、今天的日期、昨天的日期。有需要的朋友,参考下吧。
1,PHP返回明天的日期
代码:
<?php function get_tomorrow_date() { $tomorrow = mktime(0,0,0,date("m"),date("d")+1,date("Y")); return date("Y-m-d", $tomorrow); } //by www.jbxue.com ?>
2,PHP返回今天的日期
<?php function get_today_date() { $today=date("Y-m-d"); return today; } //by www.jbxue.com ?>
3,PHP返回昨天的日期
<?php function get_last_date() { $tomorrow = mktime(0,0,0,date("m"),date("d")-1,date("Y")); return date("Y-m-d", $tomorrow); } //by www.jbxue.com ?>
说明:以上主要是php中日期函数的具体应用,希望对大家有所帮助。
您可能感兴趣的文章:
php返回日期的实例(明天的日期、今天的日期、昨天的日期)
php日期函数的简单示例代码
php mysql日期操作的小例子
php计算日期相差天数(日期计算)代码
mysql时间查询操作实例
php获取昨天与明天的日期的代码
PHP日期实例 php获取今天、昨天、明天的日期
c# 日期与时间函数(都是常用的,错过了就后悔永远的)
php日期与时间运算实例分享
PHP中计算时间差的几种方法
上一篇:PHP检查是否本地服务器的代码
下一篇:php实现返回离当前数字最近的数
[关闭]