PHP Tutorial

A web server programming language.

PHP Date and Time

PHP Date() Function

The PHP date() function is used to format a date and/or a time.

Syntax:

date(format, timestamp)

Common Format Characters:

  • d - Day of the month (01 to 31)
  • m - Month (01 to 12)
  • Y - Year (in four digits)
  • H - Hour (00 to 23)
  • i - Minutes (00 to 59)
  • s - Seconds (00 to 59)

Try It Yourself

Edit the code below and click Run to see the result live.

Source Code
Result
Topics