comment_time()WP 0.71

Display the comment time of the current comment.

No Hooks.


null. Ничего (null).


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



#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>


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

comment_time() code WP 6.4.1

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