A WordPress-centric search engine for devs and theme authors



get_comment_date ›

Since1.5.0
Deprecatedn/a
get_comment_date ( $d = '', $comment_ID = 0 )
Parameters: (2)
  • (string) $d Optional. The format of the date. Default user's setting.
    Required: No
    Default: (empty)
  • (int|WP_Comment) $comment_ID WP_Comment or ID of the comment for which to get the date. Default current comment.
    Required: No
    Default:
Returns:
  • (string) The comment's date.
Defined at:
Codex:
Change Log:
  • 4.4.0

Retrieve the comment date of the current comment.



Source

function get_comment_date( $d = '', $comment_ID = 0 ) {
	$comment = get_comment( $comment_ID );
	if ( '' == $d ) {
		$date = mysql2date( get_option( 'date_format' ), $comment->comment_date );
	} else {
		$date = mysql2date( $d, $comment->comment_date );
	}
	/**
	 * Filters the returned comment date.
	 *
	 * @since 1.5.0
	 *
	 * @param string|int $date    Formatted date string or Unix timestamp.
	 * @param string     $d       The format of the date.
	 * @param WP_Comment $comment The comment object.
	 */
	return apply_filters( 'get_comment_date', $date, $d, $comment );
}