comment_time()WP 0.71

Outputs the time of the comment publication. Used inside the comment loop.

No Hooks.

Returns

null. Displays the text - the date of the comment.

Usage

comment_time( $d );
$d(string)
The date output format. Date format examples see here.
By default: the time format set in the settings

Examples

0

#1 Print the time of the current comment in the format 22:04:11.

The code should be used inside the comment loop, usually a built-in function specified in the callback parameter of the wp_list_comments() function is responsible for displaying comments:

<p>Comment publishing time: <?php comment_time('H:i:s'); ?></p>

Changelog

Since 0.71 Introduced.
Since 6.2.0 Added the $comment_id parameter.

comment_time() code WP 6.9

function comment_time( $format = '', $comment_id = 0 ) {
	echo get_comment_time( $format, false, true, $comment_id );
}