PHP | getdate() Function Last Updated : 03 Jul, 2018 Comments Improve Suggest changes Like Article Like Report The getdate() function is an inbuilt function in PHP which is used to get date/time information of the current local date/time. Syntax: getdate($timestamp) 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()). Return Value: 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 [0] - seconds since Unix Epoch Below programs illustrate the getdate() function in PHP: Program 1: php <?php // PHP program to illustrate // getdate() function print_r(getdate()); ?> Output: Array ( [seconds] => 40 [minutes] => 25 [hours] => 6 [mday] => 3 [wday] => 2 [mon] => 7 [year] => 2018 [yday] => 183 [weekday] => Tuesday [month] => July [0] => 1530599140 ) Program 2: php <?php // Unix timestamp for date // 27-june-2018 10:10:10 // is 1530094210 $y = 1530094210; $today = getdate($y); print_r($today); ?> Output: Array ( [seconds] => 10 [minutes] => 10 [hours] => 10 [mday] => 27 [wday] => 3 [mon] => 6 [year] => 2018 [yday] => 177 [weekday] => Wednesday [month] => June [0] => 1530094210 ) Reference: http://php.net/manual/en/function.getdate.php Comment More infoAdvertise with us Next Article PHP | getdate() Function R R_Raj Follow Improve Article Tags : Web Technologies PHP PHP-date-time PHP-function Similar Reads PHP | gmdate() Function The gmdate() is an inbuilt function in PHP which is used to format a GMT/UTC date and time and return the formatted date strings. It is similar to the date() function but it returns the time in Greenwich Mean Time (GMT). Syntax: string gmdate ( $format, $timestamp ) Parameters: The gmdate() function 2 min read PHP | idate() Function The idate() function is an inbuilt function in PHP which is used to format a local time/date as an integer. The $format and $timestamp are sent as parameters to the idate() function and it returns an integer formatted according to the specified format using the given timestamp. Unlike the function d 2 min read PHP | gettimeofday() Function The gettimeofday() function is an inbuilt function in PHP which is used to return the current time. It is an interface to Unix system call gettimeofday(2). It returns an associative array containing the data returned from the system call. The float option is sent as a parameter to the gettimeofday() 2 min read PHP | gmstrftime() Function The gmstrftime() function is an inbuilt function in PHP which is used to format a GMT/UTC time/date according to local settings. The gmstrftime() function in PHP behaves in the same way as strftime() except that the time returned by the gmstrftime() function is Greenwich Mean Time (GMT). The $format 2 min read PHP | gmmktime() Function The gmmktime() function is an inbuilt function in PHP which is used to return the Unix timestamp for a GMT date. The $hour, $minute, $second, $month, $day, $year and $is_dst are sent as parameters to the gmmktime() function and it returns an integer Unix timestamp on success or False on error. Synta 2 min read Like