• 欢迎访问开心洋葱网站,在线教程,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站,欢迎加入开心洋葱 QQ群
  • 为方便开心洋葱网用户,开心洋葱官网已经开启复制功能!
  • 欢迎访问开心洋葱网站,手机也能访问哦~欢迎加入开心洋葱多维思维学习平台 QQ群
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏开心洋葱吧~~~~~~~~~~~~~!
  • 由于近期流量激增,小站的ECS没能经的起亲们的访问,本站依然没有盈利,如果各位看如果觉着文字不错,还请看官给小站打个赏~~~~~~~~~~~~~!

PHP GETDATE – 获取当前日期时间作为一个关联数组

PHP 水墨上仙 1486次浏览

PHP GETDATE函数是用来获得当前的日期和时间,从操作系统或一个关联数组转换成UNIX风格的日期整数。

语法格式如下


array getdate ();
array getdate (integer $Time);

参数如下:
Arguments

$Time
The&nbspnumber&nbspof&nbspseconds&nbspsince&nbspmidnight&nbspbefore&nbspJanuary&nbsp1,&nbsp1970.&nbsp(UNIX&nbspstyle.)
Default
The&nbspdefault&nbspis&nbspthe&nbspcurrent&nbspdate&nbspand&nbsptime&nbspfrom&nbspthe&nbspoperating&nbspsystem.)

The&nbspreturn&nbspvalue&nbspis&nbspan&nbspassociative&nbsparray&nbspcontaining:

mon The&nbspmonth&nbspof&nbspthe&nbspyear&nbspas&nbspa&nbspnumber&nbsp(1..12)
mday The&nbspday&nbspof&nbspthe&nbspmonth&nbsp(1..31)
year The&nbspyear&nbsp(4&nbspdigits)
hours The&nbsphour&nbspof&nbspthe&nbspday&nbsp(0..23)
minutes The&nbspminutes&nbspof&nbspthe&nbsphour&nbsp(0..59)
seconds The&nbspseconds&nbspof&nbspthe&nbspminute&nbsp(0..59)
month The&nbspmonth&nbspof&nbspthe&nbspyear&nbspas&nbspa&nbspword&nbsp(January..December)
yday The&nbspday&nbspof&nbspthe&nbspyear&nbsp(0..365)
wday The&nbspday&nbspof&nbspthe&nbspweek&nbspas&nbspa&nbspnumber&nbsp(0..6)
weekday The&nbspday&nbspof&nbspthe&nbspweek&nbspas&nbspa&nbspword&nbsp(Sunday..Saturday)
0 Seconds&nbspsince&nbspmidnight&nbspbefore&nbspJanuary&nbsp1,&nbsp1970

下面是一个使用范例:



<?php
 
$Now = getdate();
 
foreach ($Now as $Key => $Value) {
  echo "$Key => $Value\n";
}
 
?>

输出结果如下:



Output:
seconds => 59
minutes => 14
hours => 7
mday => 26
wday => 6
mon => 12
year => 2009
yday => 359
weekday => Saturday
month => December
0 => 1261811699


开心洋葱 , 版权所有丨如未注明 , 均为原创丨未经授权请勿修改 , 转载请注明PHP GETDATE – 获取当前日期时间作为一个关联数组
喜欢 (0)
加载中……