PHP使用GETDATE獲取當前日期時間作為一個關聯(lián)數(shù)組的方法
來源:易賢網 閱讀:1273 次 日期:2015-03-23 14:40:26
溫馨提示:易賢網小編為您整理了“PHP使用GETDATE獲取當前日期時間作為一個關聯(lián)數(shù)組的方法”,方便廣大網友查閱!

這篇文章主要介紹了PHP使用GETDATE獲取當前日期時間作為一個關聯(lián)數(shù)組的方法,實例分析了php中GETDATE函數(shù)使用技巧,需要的朋友可以參考下

本文實例講述了PHP使用GETDATE獲取當前日期時間作為一個關聯(lián)數(shù)組的方法。分享給大家供大家參考。具體分析如下:

PHP GETDATE函數(shù)是用來獲得當前的日期和時間,從操作系統(tǒng)或一個關聯(lián)數(shù)組轉換成UNIX風格的日期整數(shù)。

語法格式如下

array getdate ();

array getdate (integer $Time);

參數(shù)如下:

Arguments

$Time

The number of seconds since midnight before January 1, 1970. (UNIX style.)

Default

The default is the current date and time from the operating system.)

The return value is an associative array containing:

mon The month of the year as a number (1..12)

mday The day of the month (1..31)

year The year (4 digits)

hours The hour of the day (0..23)

minutes The minutes of the hour (0..59)

seconds The seconds of the minute (0..59)

month The month of the year as a word (January..December)

yday The day of the year (0..365)

wday The day of the week as a number (0..6)

weekday The day of the week as a word (Sunday..Saturday)

0 Seconds since midnight before January 1, 1970

下面是一個使用范例:

<?php

$Now = getdate();

foreach ($Now as $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程序設計有所幫助。

更多信息請查看IT技術專欄

更多信息請查看網絡編程

2026國考·省考課程試聽報名

  • 報班類型
  • 姓名
  • 手機號
  • 驗證碼
關于我們 | 聯(lián)系我們 | 人才招聘 | 網站聲明 | 網站幫助 | 非正式的簡要咨詢 | 簡要咨詢須知 | 新媒體/短視頻平臺 | 手機站點 | 投訴建議
工業(yè)和信息化部備案號:滇ICP備2023014141號-1 云南省教育廳備案號:云教ICP備0901021 滇公網安備53010202001879號 人力資源服務許可證:(云)人服證字(2023)第0102001523號
聯(lián)系電話:0871-65099533/13759567129 獲取招聘考試信息及咨詢關注公眾號:hfpxwx
咨詢QQ:1093837350(9:00—18:00)版權所有:易賢網