Home >Backend Development >PHP Tutorial >How to use php getdate function
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.
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!