get_post_datetime


get_post_datetime ( $post = null, $field = 'date' )

Parameters:
  • (int|WP_Post) $post Optional. WP_Post object or ID. Default is global `$post` object.
  • (string) $field Optional. Post field to use. Accepts 'date' or 'modified'.
Returns:
  • (DateTimeImmutable|false) Time object on success, false on failure.
Defined at:

Description

Retrieve post published or modified time as a `DateTimeImmutable` object instance.

The object will be set to the timezone from WordPress settings.

Related Functions

get_post_time, get_post_modified_time, get_post_stati, get_postdata, get_post_states

Top Google Results

User discussions

wpseek mobile