get_the_date()WP 3.0.0

Gets the creation date of the current post. you can specify an arbitrary date output format. Used in a WordPress loop.

This function is different from the_date(). It always return a result (date), even if the next post (in the loop) was published on the same day (the_date() will skip such date output).

You can use the get_the_date filter to change the output string.

Used By: the_date()
1 time — 0.000723 sec (slow) | 50000 times — 1.44 sec (fast) | PHP 7.2.5, WP 4.9.6
Hooks from the function


String|Int|false. Date the current post was written. False on failure.


get_the_date( $format, $post );
PHP date format. option.
Default: 'date_format'
Post ID or WP_Post object.
Default: current post



#1 Specify an arbitrary date format

Post published at <?php echo get_the_date('n-j-Y'); ?>

Displays: Post published at 11-6-2018


#2 A basic example

Display the date of the post within the WordPress Loop.

<span class="entry-date"><?php echo get_the_date(); ?></span>


Since 3.0.0 Introduced.

get_the_date() code WP 6.5.3

function get_the_date( $format = '', $post = null ) {
	$post = get_post( $post );

	if ( ! $post ) {
		return false;

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

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

	 * Filters the date a post was published.
	 * @since 3.0.0
	 * @param string|int  $the_date Formatted date string or Unix timestamp if `$format` is 'U' or 'G'.
	 * @param string      $format   PHP date format.
	 * @param WP_Post     $post     The post object.
	return apply_filters( 'get_the_date', $the_date, $format, $post );