Summery Summery
Retrieves the comment time of the current comment.
Syntax Syntax
Parameters Parameters
- $format
-
(Optional) The format of the time. Default user's settings.
Default value: ''
- $gmt
-
(Optional) Whether to use the GMT date.
Default value: false
- $translate
-
(Optional) Whether to translate the time (for use in feeds).
Default value: true
Return Return
(string) The formatted time.
Source Source
File: wp-includes/comment-template.php
* @param string $format Optional. The format of the time. Default user's settings.
* @param bool $gmt Optional. Whether to use the GMT date. Default false.
* @param bool $translate Optional. Whether to translate the time (for use in feeds).
* Default true.
* @return string The formatted time.
*/
function get_comment_time( $format = '', $gmt = false, $translate = true ) {
$comment = get_comment();
$comment_date = $gmt ? $comment->comment_date_gmt : $comment->comment_date;
$_format = ! empty( $format ) ? $format : get_option( 'time_format' );
$date = mysql2date( $_format, $comment_date, $translate );
/**
* Filters the returned comment time.
*
* @since 1.5.0
*
* @param string|int $date The comment time, formatted as a date string or Unix timestamp.
* @param string $format Date format.
* @param bool $gmt Whether the GMT date is in use.
Advertisement
Changelog Changelog
| Version | Description |
|---|---|
| 1.5.0 | Introduced. |