comment_time()WP 0.71

Display the comment time of the current comment.

No Hooks.

Return

null. Nothing (null).

Usage

comment_time( $format, $comment_id );
$format(string)
PHP time format. option.
Default: 'time_format'
$comment_id(int|WP_Comment)
WP_Comment or ID of the comment for which to print the time.
Default: current comment

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.5.2

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