Warning: Trying to access array offset on false in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 216
get_comment_time() - 检索当前评论的时间 - WordPress函数 - WordPress动力
当前浏览:首页 / WordPress函数 / get_comment_time()

get_comment_time( string $format = '', bool $gmt = false, bool $translate = true )

检索当前评论的时间


Warning: Undefined array key -1 in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/reference-cat.php on line 185

Warning: Undefined array key 3 in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/reference-cat.php on line 186

Warning: Undefined variable $searchand in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 154

Warning: Undefined array key "8a120dc4a793b62501729a9a51316687" in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 223

Warning: Undefined variable $searchand in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 154

Warning: Undefined array key "fa7798d2e83d76c537dd953794f65417" in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 223

comment 评论more...

timemore...


参数

$format

(string) (可选) PHP时间格式,默认为“time_format”选项。

默认值: ''

$gmt

(bool) (可选) 是否使用GMT日期。

默认值: false

$translate

(bool) (可选) 是否转换时间(用于feed)。

默认值: true


返回

(string) 格式化的时间。



源码

查看源码 官方文档


更新日志

版本描述
1.5.0开始引入

使用示例

  • 示例1

    不同时间格式的示例

    // Prints something like: 03:08:46 PM
    echo get_comment_time( 'h:i:s A' );
    
    // Prints something like: 3:08:46 pm
    echo get_comment_time( 'g:i:s a' );
    
    // Prints 24 hour time, something like: 0800
    echo get_comment_time( 'Hi' );
    
    // Prints 24 hour time, something like: 800
    echo get_comment_time( 'Gi' );