PHP getdate()Functions

PHP Date/TimePHP Date/Time Reference Manual

Examples

Returns the date/time information of the current local date/time:

<?php
print_r(getdate());
?>

Run example »

Definition and Usage

The getdate() function returns the date/time information of a timestamp or the current local date/time.

Syntax

getdate(timestamp);

Parameter Description
timestamp Optional. Specifies an integer Unix timestamp. Defaults to the current local time (time()).

Technical Details

Return value: Returns an associative array with information related to the timestamp:
  • [seconds] - seconds
  • [minutes] - minutes
  • [hours] - hours
  • [mday] - day of the month
  • [wday] - day of the week
  • [mon] - month
  • [year] - year
  • [yday] - day of the year
  • [weekday] - name of the weekday
  • [month] - name of the month
PHP Version: 4+


PHP Date/TimePHP Date/Time Reference Manual Other Extensions