The Date and Time manipulation in PHP contains a wide variety of integrated functions. These functions are listed below.

The list of Date and Time functions of PHP:

  • checkdate() - Validate a Gregorian date
  • date_add() - Alias of DateTime::add
  • date_create_from_format() - Alias of DateTime::createFromFormat
  • date_create() - Alias of DateTime::__construct
  • date_default_timezone_get() - Gets the default timezone used by all date/time functions in a script
  • date_default_timezone_set() - Sets the default timezone used by all date/time functions in a script
  • date_format() - Alias of DateTime::format
  • date_time_set() - Alias of DateTime::setTime
  • date_timestamp_get() - Alias of DateTime::getTimestamp
  • date_timestamp_set() - Alias of DateTime::setTimestamp
  • date_timezone_get() - Alias of DateTime::getTimezone
  • date_timezone_set() - Alias of DateTime::setTimezone
  • date() - Format a local time/date
  • getdate() - Get date/time information
  • gettimeofday() - Get current time
  • gmdate() - Format a GMT/UTC date/time
  • gmmktime() - Get Unix timestamp for a GMT date
  • gmstrftime() - Format a GMT/UTC time/date according to locale settings
  • time() - Return current Unix timestamp

Basic examples with date and time functions

 

›› go to examples ››