Copyright © tutorialspoint.com

PHP Function getdate()

previous
Advertisements

Syntax

array getdate ( [int $timestamp] );

Definition and Usage

Returns a string formatted according to the given format string using the given integer timestamp or the current time if no timestamp is given. In other words, timestamp is optional and defaults to the value of time().

Paramters

ParameterDescription
timestampOptional. This 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 Value

Returns an associative array of information related to the typestamp. The returning array contains ten elements with relevant information needed when formatting a date string:

Example

Following is the usage of this function:

<?php
$today = getdate();
print_r($today);
?>

This will produce following result:

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

Copyright © tutorialspoint.com