日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) >

getdate函数_PHP getdate()函数与示例

發(fā)布時(shí)間:2023/12/1 53 豆豆
生活随笔 收集整理的這篇文章主要介紹了 getdate函数_PHP getdate()函数与示例 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

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ù)用于獲取本地日期/時(shí)間(或也用于根據(jù)給定的時(shí)間戳獲取日期/時(shí)間。

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 –這是一個(gè)可選參數(shù),用于指定時(shí)間戳(基于整數(shù)UNIX時(shí)間戳)–如果不傳遞時(shí)間戳,該函數(shù)將返回本地日期/時(shí)間。

Timestamps: Following are the timestamps,

時(shí)間戳記 :以下是時(shí)間戳記,

  • seconds - it is used to get the time in seconds

    秒 -用于獲取時(shí)間(以秒為單位)

  • minutes - it is used to get the time in minutes

    分鐘 -用于獲取以分鐘為單位的時(shí)間

  • hours - it is used to get the time in hours

    小時(shí) -用于獲取小時(shí)數(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以來(lái)的秒數(shù)

Return value:

返回值:

It returns an array of the date/time information with the timestamp

它返回帶有時(shí)間戳的日期/時(shí)間信息數(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: 1565700988

Reference: PHP getdate() function

參考: PHP getdate()函數(shù)

翻譯自: https://www.includehelp.com/php/getdate-function-with-example.aspx

getdate函數(shù)

總結(jié)

以上是生活随笔為你收集整理的getdate函数_PHP getdate()函数与示例的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。