天天看点

PHP专题-开发基础(八)

日期与时间

1.取得和改变默认时区

date_default_timezone_get()

设定用于一个脚本中所有日期时间函数的默认时区

2.date()

 date 函数格式化参考表

http://bbs.itzk.com/thread-1547-1-1.html

3.gatdate()

格式:gatdate([int $timestamp])

根据给定时间戳$timestamp的值,返回一个完整的日期的关联数组

4.checkdate()

格式:boolean checkdate(int month,int day,int year);

检测一个日期格式是否争取,它接受的参数是月,日,年,返回的是一个布尔值

5.time()

返回系统当前时间

6.mktime()

格式:mktime($hour,$minute,$second,$month,$day,$year)

此函数的作用与getdate()函数的功能正好相对,它由一系列的日期与时间值生成一个UNINX时间戳

7.strtotime()

此函数可將英文日期/时间字符串转换成UNIX时间戳

8.strftime()

將UNIX时间戳格式化成适用于系统当前环境的日期字符串

格式:strftime($format,$ts)

9.gmmktime()

生成一个当前GMT即时时间的UNIX时间戳

10.gmdate()

將UNIX时间戳格式化成可阅读的日期字符串