日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > php >内容正文

php

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

發布時間:2023/12/1 php 34 豆豆
生活随笔 收集整理的這篇文章主要介紹了 getdate函数_PHP getdate()函数与示例 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

getdate函數

PHP getdate()函數 (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()函數用于獲取本地日期/時間(或也用于根據給定的時間戳獲取日期/時間。

Syntax:

句法:

getdate(timestamp);

Parameter(s):

參數:

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

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

    小時 -用于獲取小時數

  • 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以來的秒數

Return value:

返回值:

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

它返回帶有時間戳的日期/時間信息數組

Example: PHP code to demonstrate the example of getdate() function

示例:PHP代碼演示getdate()函數的示例

<?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()函數

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

getdate函數

總結

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

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。