Home >Backend Development >PHP Tutorial >How to use php getdate function

How to use php getdate function

藏色散人
藏色散人Original
2019-02-21 17:34:444646browse

php getdate function is used to return the "date/time" information of the current local "date/time". Its syntax is "getdate(timestamp)". This function will return information related to the timestamp. associative array.

How to use php getdate function

php The getdate() function is used to return the date/time information of the current local date/time. The syntax is getdate(timestamp). This function returns an associative array with information related to the timestamp.

How to use the php getdate function?

Function: Return the date/time information of the current local date/time

Syntax:

getdate(timestamp)

Parameters:

timestamp Optional. Specifies Unix timestamp, integer value. Defaults to the current local time (time()).

Description: Returns an associative array with information related to the timestamp: [seconds] - seconds, [minutes] - minutes, [hours] - hours, [mday] - day of the month , [wday] - day of the week, [mon] - month, [year] - year, [yday] - day of the year, [weekday] - name of the day of the week, [month] - name of the month , [0] - Number of seconds elapsed since the Unix epoch.

php getdate() function example

<?php
print_r(getdate(1524123066));
?>

Output:

Array ( [seconds] => 6 [minutes] => 31 [hours] => 15 [mday] => 19 [wday] => 4 [mon] => 4 [year] => 2018 [yday] => 108 [weekday] => Thursday [month] => April [0] => 1524123066 )

This article is about the use of getdate() function. I hope it will be helpful to friends who need it. !

The above is the detailed content of How to use php getdate function. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn