Latest web development tutorials

PHP getdate () function

PHP Date / Time PHP Date / Time Reference Manual

Examples

Local returns the current date / time, date / time information:

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

Running instance »

Definition and Usage

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

grammar

getdate( timestamp);

参数 描述
timestamp 可选。规定整数的 Unix 时间戳。默认为当前本地时间(time())。

technical details

return value: Returns associative array with the timestamp information related to:
  • [Seconds] - seconds
  • [Minutes] - points
  • [Hours] - hours
  • [Mday] - the first few days of the month
  • [Wday] - day of the week
  • [Mon] - month
  • [Year] - years
  • [Yday] - the day of year
  • [Weekday] - the name of the week
  • [Month] - name of the month
  • [0] - since Unix epoch number of seconds elapsed
PHP version: 4+


PHP Date / Time PHP Date / Time Reference Manual