PHP getdate() function

This function is used to get current date and time information. It returns an associative array containing date information about the local time or the specified timestamp.

Syntax

getdate(timestamp);

The timestamp is an optional parameter. If it is not specified then, it returns date information of the given timestamp.

Example

<?php
    $today_dateinfo = getdate();
    echo '<pre>'; print_r($today_dateinfo);
?>

Output -

Array
(
    [seconds] => 15
    [minutes] => 55
    [hours] => 10
    [mday] => 20
    [wday] => 6
    [mon] => 4
    [year] => 2024
    [yday] => 110
    [weekday] => Saturday
    [month] => April
    [0] => 1713610515
)




Related PHP Functions

PHP array_reverse() function
PHP array_diff() function
PHP array_key_exists() function
PHP array_push() function
PHP array_search() function
PHP class_exists() function
PHP curl_setopt() function
PHP die() function
PHP dirname() function
PHP each() function
PHP explode() function
PHP file_exists() function
PHP function_exists() function
PHP getenv() function
PHP is_readable() function
PHP ksort() function
PHP mkdir() function
PHP ob_start() function
PHP parse_url() function
PHP str_repeat() function
PHP substr() function




Read more articles


General Knowledge



Learn Popular Language