get_comment_date()
get_comment_date( string $format = ”, int|WP_Comment $c…
get_comment_date( string $format = ”, int|WP_Comment $comment_ID )
检索当前注释的注释日期。
Retrieves the comment date of the current comment.
目录锚点:#参数#返回#源码#笔记
参数(Parameters)
| 参数 | 类型 | 必填 | 说明 | 
|---|---|---|---|
| $format | (string) | 可选 | 日期的格式。默认用户设置。 | 
| $comment_ID | (int | WP_Comment) | 可选 | WP_注释或要获取日期的注释的ID。默认当前注释。 | 
返回(Return)
(string)注释的日期。
源码(Source)
/**
 * Retrieve the comment date of the current comment.
 *
 * @since 1.5.0
 *
 * @param string $d          Optional. The format of the date. Default user's setting.
 * @param int    $comment_ID ID of the comment for which to get the date. Default current comment.
 * @return string The comment's date.
 */
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);
	/**
	 * Filter 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 object     $comment The comment object.
	 */
	return apply_filters( 'get_comment_date', $date, $d, $comment );
}| 更新版本 | 源码位置 | 使用 | 被使用 | 
|---|---|---|---|
| 4.4.0 | wp-includes/comment-template.php:551 | 4 | 5 | 
笔记(Notes)
显示一个美丽的,可读的,评论时间:
基本示例
不同日期格式的示例
类别:WordPress 函数手册、 
		本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。



还没有任何评论,赶紧来占个楼吧!