IMPRESS dotted_line CONTACT dotted_line search dotted_line Kontakt dotted_line sitemap dotted_line print
75 PHP-Resource users online

Switch to another languags Deutsch aktuelle Sprache Englisch

PHP Manual


(PHP 4, PHP 5)

getdateGet date/time information


array getdate ([ int $timestamp = time() ] )

Returns an associative array containing the date information of the timestamp, or the current local time if no timestamp is given.



The optional timestamp parameter is an integer Unix timestamp that defaults to the current local time if a timestamp is not given. In other words, it defaults to the value of time().

Return Values

Returns an associative array of information related to the timestamp. Elements from the returned associative array are as follows:

Key elements of the returned associative array
Key Description Example returned values
"seconds" Numeric representation of seconds 0 to 59
"minutes" Numeric representation of minutes 0 to 59
"hours" Numeric representation of hours 0 to 23
"mday" Numeric representation of the day of the month 1 to 31
"wday" Numeric representation of the day of the week 0 (for Sunday) through 6 (for Saturday)
"mon" Numeric representation of a month 1 through 12
"year" A full numeric representation of a year, 4 digits Examples: 1999 or 2003
"yday" Numeric representation of the day of the year 0 through 365
"weekday" A full textual representation of the day of the week Sunday through Saturday
"month" A full textual representation of a month, such as January or March January through December
0 Seconds since the Unix Epoch, similar to the values returned by time() and used by date(). System Dependent, typically -2147483648 through 2147483647.


Example #1 getdate() example


The above example will output something similar to:

    [seconds] => 40
    [minutes] => 58
    [hours]   => 21
    [mday]    => 17
    [wday]    => 2
    [mon]     => 6
    [year]    => 2003
    [yday]    => 167
    [weekday] => Tuesday
    [month]   => June
    [0]       => 1055901520

See Also

Comments to the PHP manual
Write new comment


New Tutorial entries

Migration einer PHP 5 App auf PHP 7

Dieses PHP 7 Tutorial zeigt dir, wie du dein PHP5 Script auf PHP7 umstellst.

Berni | Category: PHP
PHP 7 Virtual Machine

Dieser Artikel zielt darauf ab, einen Überblick über die Zend Virtual Machine, wie es in PHP 7 gefunden wird.

Berni | Category: PHP
plotting masters - a professional guide - Teil II

Grafische Interpolation und Bestapproximation von numerischen Wertepaaren: Wir wollen Punkte auf einer Zeichenebene über verschiedene Verfahren miteinander verbinden.

EVAMasters | Category: PHP