getdate

(PHP 3, PHP 4 )

getdate -- Get date/time information

Description

array getdate ( [int timestamp])

Returns an associative array containing the date information of the timestamp, or the current local time if no timestamp is given, as the following associative array elements:

Таблица 1. The following characters are recognized in the format parameter string

KeyDescriptionExample returned values
"seconds"Numeric representation of seconds0 to 59
"minutes"Numeric representation of minutes0 to 59
"hours"Numeric representation of hours0 to 23
"mday"Numeric representation of the day of the month1 to 31
"wday"Numeric representation of the day of the week0 (for Sunday) through 6 (for Saturday)
"mon"Numeric representation of a month1 through 12
"year"A full numeric representation of a year, 4 digitsExamples: 1999 or 2003
"yday"Numeric representation of the day of the year0 through 366
"weekday"A full textual representation of the day of the weekSunday through Saturday
"month"A full textual representation of a month, such as January or MarchJanuary> through December

Пример 1. getdate() example

<?php
$today = getdate(); 
$month = $today['month']; 
$mday = $today['mday']; 
$year = $today['year']; 
echo "$month $mday, $year";
?>