getdate

array getdate(int time) 

Gets date and time information for a UNIX timestamp.

Returns:

Array containing date/time information

Description:

getdate() creates an array of 10 elements containing most of the relevant information needed when formatting a date string. It can be very useful when combined with mktime() or date(). The array contains the following keys:

Value Description
seconds Seconds
minutes Minutes
hours Hours
mday Day of the month (numeric)
wday Day of the week (numeric)
year Year
yday Day of the year (numeric)
weekday Name of the weekday; for example, Tuesday
month Name of the month; for example, April

Version:

PHP 3, PHP 4

See also:

date() 
checkdate() 
mkdate() 

Example:

Print the current date and time
 $my_time = getdate(date('U')); ...

Get PHP Functions Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.