2

I have been trying for some time now to reformat the date that appears below the avatar when a comment is made to a blog post.

I have found no way of doing it through any settings, so I have moved over to the template files. Changing the date format of the original blog post was easy, but with comments, no variable holding the date in raw (unix) format is passed in to the template, so I can't reformat and extract the pieces of the date that I want.

The Zen theme help note says:

* - $created: Formatted date and time for when the comment was created.

I would like to reformat this from Tue, 2011-09-13 11:57

Into two separate variables, 13 Sep, 2011 11:57

any idéas? Thanks

1
  • here: admin/config/regional/date-time - you cannot change ?
    – rémy
    Sep 13, 2011 at 11:00

1 Answer 1

2

In your template file you should have access to the $node variable so you can do something like this:

echo date('j M, Y H:i', $node->created);

See the PHP date page for information on the format string used above.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.