位置: 编程技术 - 正文
推荐整理分享PHP:getdate()的用法_Date Time函数(php getdate()方法),希望有所帮助,仅作参考,欢迎阅读内容。
文章相关热门搜索词:php gettext,php getenv,php gettype,php __get(),php中get的用法,php gettype,php getdate(),php __get(),内容如对您有帮助,希望把文章链接给更多的朋友!
(PHP 4, PHP 5)
getdate — 取得日期/时间信息
说明 array getdate ([ int $timestamp = time() ] )返回一个根据 timestamp 得出的包含有日期信息的关联数组 array。如果没有给出时间戳则认为是当前本地时间。
参数timestamp
可选的 timestamp 参数是一个 integer 的 Unix时间戳,如未指定,参数值默认为当前本地时间。也就是说,其值默认为time() 的返回值。
返回值返回一个根据 timestamp 得出的包含有日期信息的关联数组 array。 返回的关联数组中的键名单元有以下几个:
返回的关联数组中的键名单元 键名 说明 返回值例子 "seconds" 秒的数字表示 0 到 "minutes" 分钟的数字表示 0 到 "hours" 小时的数字表示 0 到 "mday" 月份中第几天的数字表示 1 到 "wday" 星期中第几天的数字表示 0 (周日) 到 6 (周六) "mon" 月份的数字表示 1 到 "year" 4 位数字表示的完整年份 比如: 或 "yday" 一年中第几天的数字表示 0 到 "weekday" 星期几的完整文本表示 Sunday 到 Saturday "month" 月份的完整文本表示,比如 January 或 March January 到 December 0 自从 Unix 纪元开始至今的秒数,和 time() 的返回值以及用于 date() 的值类似。 系统相关,典型值为从 - 到 。
范例
Example #1 getdate() 例子
<?php$today=getdate();print_r($today);?>以上例程的输出类似于:
参见date() - 格式化一个本地时间/日期 idate() - 将本地时间日期格式化为整数 localtime() - 取得本地时间 time() - 返回当前的 Unix 时间戳 setlocale() - Set locale information
PHP:date_sunset()的用法_Date Time函数 date_sunset(PHP5)date_sunset返回给定的日期与地点的日落时间说明mixeddate_sunset(int$timestamp[,int$format=SUNFUNCS_RET_STRING[,float$latitude=ini_get(date.default_latitude)[,float$long
PHP:date_sunrise()的用法_Date Time函数 date_sunrise(PHP5)date_sunrise返回给定的日期与地点的日出时间说明mixeddate_sunrise(int$timestamp[,int$format=SUNFUNCS_RET_STRING[,float$latitude=ini_get(date.default_latitude)[,float$l
PHP:date_default_timezone_set()的用法_Date Time函数 date_default_timezone_set(PHP5=5.1.0)date_default_timezone_set设定用于一个脚本中所有日期时间函数的默认时区说明booldate_default_timezone_set(string$timezone_identifier)date_defa
标签: php getdate()方法
本文链接地址:https://www.jiuchutong.com/biancheng/287369.html 转载请保留说明!友情链接: 武汉网站建设