WordPress at Your Fingertips

get_comment_date() WP 1.0

Retrieve the comment date of the current comment.

Used By: comment_date()
Hooks from the function

String. The comment's date.


get_comment_date( $format, $comment_ID );
PHP date format. option.
Default: 'date_format'
WP_Comment or ID of the comment for which to get the date.
Default: current comment


Since 1.5.0 Introduced.
Since 4.4.0 Added the ability for $comment_ID to also accept a WP_Comment object.

Code of get_comment_date() WP 5.8

function get_comment_date( $format = '', $comment_ID = 0 ) {
	$comment = get_comment( $comment_ID );

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

	$date = mysql2date( $_format, $comment->comment_date );

	 * Filters the returned comment date.
	 * @since 1.5.0
	 * @param string|int $date    Formatted date string or Unix timestamp.
	 * @param string     $format  PHP date format.
	 * @param WP_Comment $comment The comment object.
	return apply_filters( 'get_comment_date', $date, $format, $comment );

From tag: date time

More from category: Comments Loop

No comments
    Log In