HomeMenu
Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

getdate

Description

The getdate of Date / Time for PHP get date/time information.

Syntax

getdate ( int|null $timestamp = null ) : array

Parameters

timestamp

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

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

KeyDescriptionExample
"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 a day of the month1 to 31
"wday"Numeric representation of a day of the week0 to 6
"mon"Numeric representation of a month1 to 12
"year"Numeric representation of a year0000 to 9999
"yday"Numeric representation of a day of the year0 to 365
"weekday"Textual representation of a day of the weekSunday to Saturday
"month"Textual representation of a monthJanuary to December
0Seconds since the Unix EpochSystem Dependent (typically -2147483648 to 2147483647)

Examples

1 · void

<?

$return = getdate();

print_r($return);
Array
(
    [seconds] => 8
    [minutes] => 58
    [hours] => 21
    [mday] => 7
    [wday] => 6
    [mon] => 12
    [year] => 2024
    [yday] => 341
    [weekday] => Saturday
    [month] => December
    [0] => 1733608688
)

2 · timestamp

<?

$hour = 4;
$minute = 5;
$second = 6;
$month = 2;
$day = 3;
$year = 2001;

$timestamp = mktime($hour, $minute, $second, $month, $day, $year);

$return = getdate($timestamp);

print_r($return);
Array
(
    [seconds] => 6
    [minutes] => 5
    [hours] => 4
    [mday] => 3
    [wday] => 6
    [mon] => 2
    [year] => 2001
    [yday] => 33
    [weekday] => Saturday
    [month] => February
    [0] => 981173106
)