+

PHP Getdate () Function

Syntax:
getdate($timestamp)
Parameters:The getdate() function takes one parameter, and it described below:
  • $timestamp:This is an optional parameter that specifies an integer Unix timestamp. The default is the current local time ( time() ) .
Returned value:
The function returns an array with timestamp information.
  • [seconds] - seconds
  • [minutes] - minutes
  • [hours] - clock
  • [mday] - day of the month
  • [wday] - day of the week
  • [mon] - month
  • [year] - year
  • [yday] - day of the year
  • [weekday] - weekday name
  • [month] - month name
  • [0] - seconds since the Unix era
The following programs illustrate the getdate() function in PHP:
Program 1:
// PHP illustration program
// getdate() function print_r ( getdate ()); ?> Exit:
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:  
// Unix timestamp for date
// June 27, 2018 10:10:10
// this is 1530094210 $y = 1530094210; $today = getdate ( $y ); print_r ( $today ); ?>
Exit:
Array ([ seconds] = > 10 [minutes] = > 10 [hours] = > 10 [mday] = > 27 [wday] = > 3 [mon] = > 6 [year] = > 2018 [yday ] = > 177 [weekday] = > Wednesday [month] = > June [0] = > 1530094210) 
Link: http://php.net/manual/en/function.getdate.php
Get Solution for free from DataCamp guru