时间函数在平常的开发中是常常用到的,PHP中有不少已经封装好的原生函数,由于开发人员的不熟悉而在开发过程当中常常性重复的造轮子,这是一种很很差的行为习惯。php
在掌握PHP时间相关函数以前,咱们先来作一下 运行时配置数据库
$today=date_create(date('Y-m-d')); date_add($today,date_interval_create_from_date_string("30 days")); echo date_format($today,"Y-m-d"); echo date('Y-m-d', strtotime('+30 days'));
date() 包下列错误的处理办法数组
PHP Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'UTC' for '8.0/no DST' instead inide
date_date_set函数
date_default_timezone_getui
date_default_timezone_setthis
date_diff.net
$date1=date_create("1984-01-28"); $date2=date_create("1980-10-15"); $diff=date_diff($date1,$date2);