get_comment_date()
最后更新于:2021-11-26 08:40:08
get_comment_date( string$format=”, int|GC_Comment$comment_ID)Retrieves the comment date of the current comment.
参数
- $format
-
(string) (Optional) PHP date format. Defaults to the ‘date_format’ option.
Default value: ”
- $comment_ID
-
(int|GC_Comment) (Optional) GC_Comment or ID of the comment for which to get the date. Default current comment.
响应
(string) The comment’s date.
源文件
文件: gc-includes/comment-template.php
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 GC_Comment $comment The comment object.
*/
return apply_filters( 'get_comment_date', $date, $format, $comment );
}