# get_the_time()

URL: https://chugunov.pro/api-wordpress/functions/get_the_time/
Проверено на WordPress 6.9, обновлено 06.08.2026.
Источник: независимый русскоязычный справочник chugunov.pro. Не является официальной документацией WordPress.

Тип: функция.
Появился в версии: 1.5.0.

## Сигнатура

```php
get_the_time( string $format = '', int|WP_Post|null $post = null ): string|int|false
```

## Описание

Извлекает время записи.

## Параметры

- `$format` `string` — необязательный, по умолчанию `''`. Формат для получения времени написания записи. Принимает 'G', 'U' или формат даты PHP.
  
  По умолчанию используется значение опции 'time_format'.
- `$post` `int|WP_Post|null` — необязательный, по умолчанию `null`. ID записи или объект записи. По умолчанию — глобальный объект $post .

## Возвращаемое значение

`string|int|false` — $format 'U' 'G'

## Исходный код

Файл: `wp-includes/general-template.php:2852`

```php
function get_the_time( $format = '', $post = null ) {
	$post = get_post( $post );

	if ( ! $post ) {
		return false;
	}

	$_format = ! empty( $format ) ? $format : get_option( 'time_format' );

	$the_time = get_post_time( $_format, false, $post, true );

	/**
	 * Filters the time of the post.
	 *
	 * @since 1.5.0
	 *
	 * @param string|int $the_time Formatted date string or Unix timestamp if `$format` is 'U' or 'G'.
	 * @param string     $format   Format to use for retrieving the time the post
	 *                             was written. Accepts 'G', 'U', or PHP date format.
	 * @param WP_Post    $post     Post object.
	 */
	return apply_filters( 'get_the_time', $the_time, $format, $post );
}
```

## История изменений

- 1.5.0 — Introduced.

## Связанные

Использует: [`get_post_time`](https://chugunov.pro/api-wordpress/functions/get_post_time/), [`apply_filters`](https://chugunov.pro/api-wordpress/functions/apply_filters/), [`get_option`](https://chugunov.pro/api-wordpress/functions/get_option/), [`get_post`](https://chugunov.pro/api-wordpress/functions/get_post/).
Используется в: `WP_Customize_Manager::customize_pane_settings`, `WP_Posts_List_Table::column_date`, `WP_Media_List_Table::column_date`, [`wp_dashboard_recent_posts`](https://chugunov.pro/api-wordpress/functions/wp_dashboard_recent_posts/), [`wp_dashboard_recent_drafts`](https://chugunov.pro/api-wordpress/functions/wp_dashboard_recent_drafts/), [`the_time`](https://chugunov.pro/api-wordpress/functions/the_time/).

Оригинал в официальной документации: https://developer.wordpress.org/reference/functions/get_the_time/
