WordPress.org

Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/comment date

Description

Displays the date a comment was posted.

Use get_comment_date() to retrieve the value.

Usage

 <?php comment_date$d$comment_ID ); ?> 

Parameters

$d
(string) (optional) Formatting for the date.
Default: The date format set in WordPress. See Formatting Date and Time.
$comment_ID
(integer) (optional) The ID of the comment for which to print the date.
Default: 0 (the current comment)

Return Values

None. Echoes the return of get_comment_date()

Example

Displays the current comment date in the format "6-30-2004":

<div>Comment posted on <?php comment_date('n-j-Y'); ?></div>

Changelog

  •  ? : Added the 'comment_ID' parameter.
  • Since: 0.71

Source File

comment_date() is located in wp-includes/comment-template.php

Related

Formatting_Date_and_Time

Comments Functions

See also index of Function Reference and index of Template Tags.