PHP uses GETDATE to get the current date and time as a method for associating arrays _ PHP Tutorial

Source: Internet
Author: User
PHP uses GETDATE to obtain the current date and time as a method for associating arrays. PHP uses GETDATE to get the current date and time as an associated array. This article mainly introduces how PHP uses GETDATE to get the current date and time as an associated array, example: PHP uses GETDATE to get the current date and time as an associated array method

This article describes how to use GETDATE in PHP to obtain the current date and time as an associated array. The example shows how to use the GETDATE function in php. For more information, see

This example describes how PHP uses GETDATE to obtain the current date and time as an associated array. Share it with you for your reference. The specific analysis is as follows:

The php getdate function is used to obtain the current date and time, and convert from the operating system or an associated array to a UNIX-style date integer.

Syntax format:

?

1

2

Array getdate ();

Array getdate (integer $ Time );

The parameters are as follows:
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 jaruary 1, 1970

The following is an example:

?

1

2

3

4

5

6

$ Now = getdate ();

Foreach ($ Now as $ Key => $ Value ){

Echo "$ Key => $ Value \ n ";

}

?>

The output result is as follows:

?

1

2

3

4

5

6

7

8

9

10

11

Seconds => 59

Minutes => 14

Hours => 7

Mday => 26

Wday => 6

Mon => 12

Year => 2009.

Yday => 359

Weekday => Saturday

Month => December

0 => 1261811699.

I hope this article will help you with php programming.

This article describes how to use GETDATE in PHP to obtain the current date and time as an associated array...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.