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函數

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/377701.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/377701.shtml
英文地址,請注明出處:http://en.pswp.cn/news/377701.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

四、入庫管理功能的完善

一、數據庫的創建 在fiber_yy數據庫下創建yy_textile表 先隨便添加幾條數據 二、頁面的完善 登錄注冊頁面我就不演示了&#xff0c;前幾篇博文也都有介紹 warehousing入庫頁面 main_page頁面進行功能完善 三、代碼實現 warehousing頁面 using System; using System.…

leetcode 232. 用棧實現隊列 思考分析

題目 請你僅使用兩個棧實現先入先出隊列。隊列應當支持一般隊列的支持的所有操作&#xff08;push、pop、peek、empty&#xff09;&#xff1a; 實現 MyQueue 類&#xff1a; void push(int x) 將元素 x 推到隊列的末尾 int pop() 從隊列的開頭移除并返回元素 int peek() 返…

YCSB初步介紹

隨著大數據時代的到來和云計算的不斷發展&#xff0c;作為云計算最基礎的設施存儲產品也越來越多&#xff0c;開源分布式存儲系統有BigTable-like系統HBase&#xff0c;dynamo-like系統Cassandra&#xff0c;voldemort&#xff0c;Riak&#xff0c;淘寶開源的OceanBase等。當然…

kotlin實現繼承_Kotlin程序| 繼承的例子

kotlin實現繼承遺產 (Inheritance) Inheritance is a mechanism wherein a new class is derived from an existing class. 繼承是一種機制&#xff0c;其中新類是從現有類派生的。 All Kotlin Classes have a common Superclass Any, it is the Default Superclass with no S…

【C++grammar】動態類型轉換、typeid與RTTI

目錄動態類型轉換1、為何需要動態類型轉換2、dynamic_cast<>();運算符3、向上轉換和向下轉換( Upcasting and Downcasting)4、 基類對象和派生類對象的互操作5、Upcasting/Downcasting與繼承鏈上不同類的對象之間的賦值有什么關系和區別&#xff1f;typeid 運行時查詢類型…

nginx資源定向 css js路徑問題

今天玩玩項目&#xff0c;學學nginx發現還不錯&#xff0c;速度還可以&#xff0c;但是CSS JS確無法使用&#xff0c;原來Iginx配置時需要對不同類型的文件配置規則&#xff0c;真是很郁悶&#xff0c;不過想想也還是很有道理。閑暇之際&#xff0c;把配置貼上來。#user nobody…

五、庫存查詢功能的完善

一、數據庫的建立 由于查詢功能和之前的 入庫管理功能 所用的數據庫都一樣&#xff0c;這里仍使用yy_textile表 在fiber_yy數據庫下創建yy_textile表 初始數據庫信息 二、頁面的完善 登錄注冊頁面我就不演示了&#xff0c;前幾篇博文也都有介紹 query查詢頁面 main_page…

整合ajaxmin 和 less 到VS.net

我用的前端框架是bootstrap_extra, twitter團隊做的&#xff0c;這個是他的一個擴展&#xff0c;首先從上面下載一個。至于ajaxmin&#xff0c;請參考這里1) 從bootstrap_extra的解壓包中&#xff0c;復制build目錄下三個文件到項目中去&#xff0c;這三個文件分別是BatchSubsi…

轉:只能選擇GridView中的一個CheckBox(單選CheckBox)

方法1&#xff1a; protected void GridView2_RowDataBound(object sender, GridViewRowEventArgs e){CheckBox cbx e.Row.FindControl("cbID") as CheckBox;try{//綁定選中CheckBox 客戶端IDcbx.Attributes.Add("onclick", "Change(" cbx.Cli…

六、出庫管理功能的實現

一、數據庫的建立 這里仍使用yy_textile表 在fiber_yy數據庫下創建yy_textile表 初始數據庫信息 二、頁面的完善 登錄注冊頁面我就不演示了&#xff0c;前幾篇博文也都有介紹 shipment出庫管理頁面 main_page頁面進行功能完善 三、代碼實現 shipment出庫管理頁面 u…

數學建模:層次分析法實例以及代碼

博主聯系方式&#xff1a; QQ:1540984562 QQ交流群&#xff1a;892023501 群里會有往屆的smarters和電賽選手&#xff0c;群里也會不時分享一些有用的資料&#xff0c;有問題可以在群里多問問。 目錄層次分析法的思想層次分析法步驟具體案例(市政工程項目建設決策)1.問題提出2.…

c 僵尸進程_演示僵尸進程的C程序

c 僵尸進程僵尸進程 (Zombie process) A process which has finished its execution but still has an entry in the process table to report to its parent process is known as a zombie process. 一個已經完成執行但仍在進程表中具有要報告給其父進程的條目的進程稱為僵尸進…

探秘IntelliJ IDEA 13測試版新功能——調試器顯示本地變量

IntelliJ IDEA在業界被公認為最好的Java開發平臺之一&#xff0c;JetBrains公司將在12月正式發布IntelliJ IDEA 13版本。 現在&#xff0c;小編將和大家一起探秘密IntelliJ IDEA 13測試版本新功能——調試器顯示本地變量。這個功能非常強大&#xff0c;調試器可以顯示變量&…

C# Windows Form下的控件的Validator(數據驗證)

由于偶爾的一個想法&#xff0c;謀生了一個做一個windows form下的Validator控件&#xff0c;或者直接說類吧&#xff01; 因為webform下的Validator控件太好用了。哈哈&#xff0c;直接看代碼&#xff01; 下面這個類&#xff0c;主要是一個簡單的驗證類&#xff0c;不過只是起…

七、流水查詢---記錄用戶登錄信息

一、數據庫的建立 在fiber_yy數據庫下創建yy_user_record表 可以先手動填入幾條數據信息 初始數據庫信息 username為用戶賬號 sex為用戶注冊所填寫的性別 phone為用戶手機號 time為用戶登錄該系統的時間 二、頁面的設計 登錄注冊頁面我就不演示了&#xff0c;前幾篇博文…

leetcode 455. 分發餅干 思考分析

目錄題目自己的思路以及AC代碼參考思路題目 假設你是一位很棒的家長&#xff0c;想要給你的孩子們一些小餅干。但是&#xff0c;每個孩子最多只能給一塊餅干。 對每個孩子 i&#xff0c;都有一個胃口值 g[i]&#xff0c;這是能讓孩子們滿足胃口的餅干的最小尺寸&#xff1b;并…

c++ cdi+示例_C ++'not'關鍵字和示例

c cdi示例"not" is an inbuilt keyword that has been around since at least C98. It is an alternative to ! (Logical NOT) operator and it mostly uses with the conditions. “ not”是一個內置關鍵字&#xff0c;至少從C 98起就存在。 它是替代&#xff01; …

【second】Flatten Binary Tree to Linked List

遞歸 void flatten(TreeNode *root) {// Note: The Solution object is instantiated only once and is reused by each test case.flat(root);}TreeNode* flat(TreeNode* root){if(!root)return NULL;TreeNode* left_tail flat(root->left);TreeNode* right_tail flat(ro…

八、流水查詢---記錄紡織品出庫信息

一、數據庫的建立 在fiber_yy數據庫下創建yy_textile_record表 可以先手動填入幾條數據信息 初始數據庫信息 第一條數據的username是空格不是null number為織物的品號(唯一的) stock為出貨量 username為哪個賬號 time為出貨時間 二、頁面的完善 登錄注冊頁面我就不演示…

應用程序欄【WP7學習札記之九】

本節是WP7學習札記的第九篇&#xff0c;講的是系統托盤和應用程序欄&#xff0c;具體內容是系統托盤和應用程序欄的介紹&#xff0c;如何分別使用C#、xaml以及Expression Blend生成應用程序欄&#xff0c;應用程序欄的透明度以及對屏幕方向改變的支持。摘要如下&#xff1a; 系…