• Hi,

    I am using – ($comment->comment_date_gmt)

    which gives the following format:

    2010-10-12 11:56:52

    is there a friendly format, that gives the following?

    12 October 2010

    Many thanks in advance,

    Jim C.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter callender

    (@jimcallender)

    thanks Esmi, you are the best!

    Thread Starter callender

    (@jimcallender)

    Oh, just looking at the code, its not quite that easy as i’m using wpdb to show the code directly from the sql table into a custom page template.

    Can you advise what the code would be? as the php snippet you included doesnt work:

    <?php
    				global $wpdb;
    				$sql = "SELECT DISTINCT ID, post_title, post_password, comment_ID,
    				comment_post_ID, comment_author, comment_date_gmt, comment_approved,
    				comment_type,comment_author_url,
    				SUBSTRING(comment_content,1,100) AS com_excerpt
    				FROM $wpdb->comments
    				LEFT OUTER JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID =
    				$wpdb->posts.ID)
    				WHERE comment_approved = '1' AND comment_type = '' AND
    				post_password = ''
    				ORDER BY <strong>comment_date_gmt</strong> DESC
    				LIMIT 3";
    				$comments = $wpdb->get_results($sql);
    				$output = $pre_HTML;
    				$output .= "\n<ul>";
    				foreach ($comments as $comment) {
    				$output .= "\n<li>".strip_tags($comment->comment_author)
    				." commented on <br />" . "<a href=\"" . get_permalink($comment->ID) .
    				"#comment-" . $comment->comment_ID . "\" title=\"on " .
    				$comment->post_title . "\">" . strip_tags($comment->post_title, comment_date)
    				.
    				"<br />" . strip_tags($comment-><strong>comment_date_gmt</strong>) ."</li>";
    				"></a></li>";
    				}
    				$output .= "\n</ul>";
    				$output .= $post_HTML;
    				echo $output;?>

    In that case, you may want to have a look at PHP’s date function.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Display friendly date format’ is closed to new replies.