PHP使用GETDATE获取当前日期时间作为一个关联数组的方法
本文实例讲述了PHP使用GETDATE获取当前日期时间作为一个关联数组的方法。分享给大家供大家参考。具体分析如下:
PHPGETDATE函数是用来获得当前的日期和时间,从操作系统或一个关联数组转换成UNIX风格的日期整数。
语法格式如下
arraygetdate(); arraygetdate(integer$Time);
参数如下:
Arguments
$Time
ThenumberofsecondssincemidnightbeforeJanuary1,1970.(UNIXstyle.)
Default
Thedefaultisthecurrentdateandtimefromtheoperatingsystem.)
Thereturnvalueisanassociativearraycontaining:
mon Themonthoftheyearasanumber(1..12)
mday Thedayofthemonth(1..31)
year Theyear(4digits)
hours Thehouroftheday(0..23)
minutes Theminutesofthehour(0..59)
seconds Thesecondsoftheminute(0..59)
month Themonthoftheyearasaword(January..December)
yday Thedayoftheyear(0..365)
wday Thedayoftheweekasanumber(0..6)
weekday Thedayoftheweekasaword(Sunday..Saturday)
0 SecondssincemidnightbeforeJanuary1,1970
下面是一个使用范例:
<?php
$Now=getdate();
foreach($Nowas$Key=>$Value){
echo"$Key=>$Value\n";
}
?>
输出结果如下:
seconds=>59 minutes=>14 hours=>7 mday=>26 wday=>6 mon=>12 year=>2009 yday=>359 weekday=>Saturday month=>December 0=>1261811699
希望本文所述对大家的php程序设计有所帮助。
热门推荐
10 财运虎年祝福语简短语
11 单亲爸爸春节祝福语简短
12 狗狗上厕所训练
13 植物种植祝福语简短
14 翻译考试祝福语朋友简短
15 个人周年庆简短祝福语
16 狗狗怎么训练
17 分别祝福语简短搞笑英文
18 生日广州男生祝福语简短