Make WordPress Core

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#19171 closed defect (bug) (invalid)

date display

Reported by: Lordrach Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.2.1
Component: Date/Time Keywords: close
Focuses: Cc:


While setting up a wordpress site for a gaming community I was suprised that comment dates were shown like this :

Your comment is awaiting moderation.
%A %B %e%q, %Y at %I:%M %p

after some researches in the source code and randomly modifying it, I got desperate and then I wanted to see what $comment->comment_date; contain, and there was my surprise, the output was already formatted : 2011-11-05 19:10:32
containing the full date at the format y-m-d H:m:s

I went through the code and modified it this way to get it fixed :

(line 372)

function get_comment_date( $d = '', $comment_ID = 0 ) {
	$comment = get_comment( $comment_ID );
	if ( '' == $d )
		$date = mysql2date(get_option('date_format'), $comment->comment_date);
		$date = mysql2date($d, $comment->comment_date);
	if ( '' == $d )
		$d = get_option('date_format');
	//return apply_filters('get_comment_date', $date, $d);
	return $comment->comment_date;

(line 634)

function get_comment_time( $d = '', $gmt = false, $translate = true ) {
	global $comment;
	$comment_date = $gmt ? $comment->comment_date_gmt : $comment->comment_date;
	if ( '' == $d )
		$date = mysql2date(get_option('time_format'), $comment_date, $translate);
		$date = mysql2date($d, $comment_date, $translate);

	return apply_filters('get_comment_time', $date, $d, $gmt, $translate);
	return "";

(line 1371)

<div class="comment-meta commentmetadata"><a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>">
				/* translators: 1: date, 2: time */
				/*printf( __('%1$s at %2$s'), get_comment_date(),  get_comment_time()) ?></a><?php edit_comment_link(__('(Edit)'),'&nbsp;&nbsp;','' );*/
				printf( __('%1$s'), get_comment_date(),  get_comment_time()) ?></a><?php edit_comment_link(__('(Edit)'),'&nbsp;&nbsp;','' );

Change History (5)

#1 @Lordrach
6 years ago

  • Cc Lordrach added

#2 follow-up: @ocean90
6 years ago

  • Keywords needs-patch removed
  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

Please try http://wordpress.org/support/. This isn't a bug. Read through the codex to understand how WordPress hooks (and PHP) works.

#3 in reply to: ↑ 2 @Lordrach
6 years ago

Replying to ocean90:

Please try http://wordpress.org/support/. This isn't a bug. Read through the codex to understand how WordPress hooks (and PHP) works.

sorry sir but, when I change the dates format in the admin section and it doesn't apply on the client side, it's a bug, when I expect things to work as they are supposed to without interfering in the code and they don't, that's a bug, I've downloaded the wordpress zip file from the wordpress site, installed it, and I got the dates shown as %A %B %e%q, %Y at %I:%M %p, that's a bug to me, since it's a core functionality, it's not a plugin bug, so anyway, I don't give a about it, I've get it to work somehow, and I don't need to read anything besides he installation documentation.

#4 @SergeyBiryukov
6 years ago

This seems like a qTranslate bug:

Are you sure it can be reproduced on a clean installation?

Version 0, edited 6 years ago by SergeyBiryukov (next)

#5 @Lordrach
6 years ago

  • Keywords close added

thank you for your reply sir, it is indeed, I've disabled all the modifications I have done and disabled qtranslate and it worked, sorry for inconvenience, and thanks for this accurate reply !

Note: See TracTickets for help on using tickets.