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 PHP | mktime() Function The mktime() function is an inbuilt function in PHP which is used to return the Unix timestamp for a date. The timestamp returns a long integer containing the number of seconds between the Unix Epoch (January 1, 1970, 00:00:00 GMT) and the time specified. The hour, minute, second, month, day and yea 2 min read PHP | localtime() Function The localtime() function is an inbuilt function in PHP which is used to return the local time. The array returned by the localtime() function is similar to the structure returned by the C function call. The $timestamp and $is_associative are sent as parameters to the localtime() function and it retu 2 min read PHP | DatePeriod getEndDate() Function The DatePeriod::getEndDate() function is an inbuilt function in PHP which is used to return the end date. If the given date period does not have any end date then it returns NULL.Syntax: DateTimeInterface DatePeriod::getEndDate( void ) Parameters: This function does not accept any parameters. Return 1 min read PHP | jdtofrench() Function The jdtofrench() function is a built-in function which converts a Julian Day Integer to French date. The function accepts a Julian Day integer and returns the converted French Date in $month / $day / $year. Syntax: jdtofrench($jd) Parameters: The function accepts one mandatory parameter $jd which sp 2 min read PHP | jewishtojd() Function The jewishtojd() function is a built-in function which converts a Jewish Date to a Julian Day Count. The function accepts three parameters in format $month / $day / $year, which represents the date in Jewish or Hebrew calendar and converts it to a Julian Day count. Syntax: jewishtojd( $month, $day, 2 min read Like