current_time


current_time ( $type, $gmt = 0 )

Parameters:
  • (string) type Type of time to retrieve. Accepts 'mysql', 'timestamp', 'U', or PHP date format string (e.g. 'Y-m-d').
  • (int|bool) gmt Optional. Whether to use GMT timezone. Default false.
Returns:
  • (int|string) Integer if `$type` is 'timestamp' or 'U', string otherwise.
Defined at:
Change Log:
  • 5: .

Description

Retrieves the current time based on specified type.- The 'mysql' type will return the time in the format for MySQL DATETIME field. - The 'timestamp' or 'U' types will return the current timestamp or a sum of timestamp and timezone offset, depending on `$gmt`. - Other strings will be interpreted as PHP date formats (e.g. 'Y-m-d'). If `$gmt` is a truthy value then both types will use GMT time, otherwise the output is adjusted with the GMT offset for the site.

Related Functions

current_datetime, current_filter, current_action, get_current_theme, comment_time

Top Google Results

User discussions

wpseek mobile