Solved

Changing date format in a drupal template

Posted on 2014-02-28
3
384 Views
Last Modified: 2014-03-10
Hello
I am trying to customize comment.tpl.php (not the core template of course)

I would like the date to render as "time ago" I've seen this as an option in views, but I have no clue how to get the same thing in a template.

here is what I have
<div class="<?php print $classes; ?> clearfix"<?php print $attributes; ?>>
  <?php print $picture ?>
  <div class="content"<?php print $content_attributes; ?>>
    <?php
      // We hide the comments and links now so that we can render them later.
      hide($content['links']);
     print ($id); 
	 print ".&nbsp;&nbsp;";
	 print ($author);
	 print "&nbsp;";
      print strip_tags (render($content));
    ?>
    <br>
    <?php print ($created); ?>
  </div>

</div>

Open in new window


What do I need to do?
0
Comment
Question by:itkadmin
  • 2
3 Comments
 
LVL 108

Accepted Solution

by:
Ray Paseur earned 500 total points
ID: 39895715
See Practical Application #3 in this article.  It gives a function that you can easilytailor for your needs.
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_201-Handling-date-and-time-in-PHP-and-MySQL.html
0
 
LVL 2

Author Closing Comment

by:itkadmin
ID: 39917482
thanks
0
 
LVL 108

Expert Comment

by:Ray Paseur
ID: 39917503
Thanks for the points and best of luck with your project! ~Ray
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now