get_comment_date的使用方法
get_comment_date函数是检索当前评论的评论日期。
get_comment_date( string $format = '', int|WP_Comment $comment_ID )
参数
$格式
(字符串) (可选) PHP日期格式。默认为'date_format'选项。
默认值: ''
$ comment_ID
(int | WP_Comment) (可选) WP_Comment或要获取其日期的注释的ID。当前默认默认评论。
基础用法
$d = "l, F jS, Y"; $comment_date = get_comment_date( $d, $comment_ID ); echo $comment_date; // This will output something similar to "Saturday, November 6th, 2010".
调用不同的时间格式
// Prints something like: Monday 8th of August 2005 echo get_comment_date( 'l jS \of F Y' ); // Prints something like: Mon Mar 8 2012 echo get_comment_date( 'D M j Y' ); // Prints something like 07/08/2017 (dd/mm/yyyy) echo get_comment_date( 'd\/m\/Y' );
加微信交流