getdate函数_PHP getdate()函数与示例
getdate函數(shù)
PHP getdate()函數(shù) (PHP getdate() function)
getdate() function is used to get the local date/time (or it is also used to get the date/time based on the given timestamp.
getdate()函數(shù)用于獲取本地日期/時間(或也用于根據(jù)給定的時間戳獲取日期/時間。
Syntax:
句法:
getdate(timestamp);Parameter(s):
參數(shù):
timestamp – It is an optional parameter which specifies the timestamp (which is based on an integer UNIX timestamp) – if we do not pass the timestamp the function returns the local date/time.
timestamp –這是一個可選參數(shù),用于指定時間戳(基于整數(shù)UNIX時間戳)–如果不傳遞時間戳,該函數(shù)將返回本地日期/時間。
Timestamps: Following are the timestamps,
時間戳記 :以下是時間戳記,
seconds - it is used to get the time in seconds
秒 -用于獲取時間(以秒為單位)
minutes - it is used to get the time in minutes
分鐘 -用于獲取以分鐘為單位的時間
hours - it is used to get the time in hours
小時 -用于獲取小時數(shù)
mday - it is used to get the day of the month
mday-用于獲取每月的某天
wday - it is used to get the day of the week
wday-用于獲取星期幾
mon - it is used to get the month
mon-用于獲取月份
year - it is used to get the year
年 -用于獲取年份
yday - it is used to get the day of the year
yday-用于獲取一年中的某天
weekday - it is used to get the name of the week
工作日 -用于獲取星期名稱
month - it is used to get the name of the month
month-用于獲取月份的名稱
0 - it is used to get the seconds since Unix Epoch
0-用于獲取自Unix Epoch以來的秒數(shù)
Return value:
返回值:
It returns an array of the date/time information with the timestamp
它返回帶有時間戳的日期/時間信息數(shù)組
Example: PHP code to demonstrate the example of getdate() function
示例:PHP代碼演示getdate()函數(shù)的示例
<?php //getting the complete date/time //i.e. local date/time $result = getdate(); echo "getdate() result...\n"; print_r($result);//extracting the indivisual values //based on the timestamps echo "seconds: $result[seconds]\n"; echo "minutes: $result[minutes]\n"; echo "hours: $result[hours]\n"; echo "mday: $result[mday]\n"; echo "wday: $result[wday]\n"; echo "mon: $result[mon]\n"; echo "year: $result[year]\n"; echo "yday: $result[yday]\n"; echo "weekday: $result[weekday]\n"; echo "month: $result[month]\n"; echo "0: $result[0]\n"; ?>Output
輸出量
getdate() result... Array ([seconds] => 28[minutes] => 56[hours] => 12[mday] => 13[wday] => 2[mon] => 8[year] => 2019[yday] => 224[weekday] => Tuesday[month] => August[0] => 1565700988 ) seconds: 28 minutes: 56 hours: 12 mday: 13 wday: 2 mon: 8 year: 2019 yday: 224 weekday: Tuesday month: August 0: 1565700988Reference: PHP getdate() function
參考: PHP getdate()函數(shù)
翻譯自: https://www.includehelp.com/php/getdate-function-with-example.aspx
getdate函數(shù)
總結(jié)
以上是生活随笔為你收集整理的getdate函数_PHP getdate()函数与示例的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 中卫看卵巢多囊最好的医院推荐
- 下一篇: kodi播放时音频 杜比反复点亮