PHP | getdate() Function
The getdate() function is an inbuilt function in PHP which is used to get date/time information of the current local date/time.
Parameters: The getdate() function accepts one parameter and it is described below:
- $timestamp: It is an optional parameter which specifies an integer unix timestamp. Default is the current local time (time()).
The function returns an array with information of 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 weekday
- [month] – name of the month
-  – seconds since Unix Epoch
Below programs illustrate the getdate() function in PHP:
Array ( [seconds] => 40 [minutes] => 25 [hours] => 6 [mday] => 3 [wday] => 2 [mon] => 7 [year] => 2018 [yday] => 183 [weekday] => Tuesday [month] => July  => 1530599140 )
Array ( [seconds] => 10 [minutes] => 10 [hours] => 10 [mday] => 27 [wday] => 3 [mon] => 6 [year] => 2018 [yday] => 177 [weekday] => Wednesday [month] => June  => 1530094210 )