Solved

Changing date format in a drupal template

Posted on 2014-02-28
3
398 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 109

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 109

Expert Comment

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

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
designing in object programming 12 76
PHP & MySql - Turn Select Query Results into a Glyphicon 3 30
PHP Form Calculate Total Price 10 42
How would I do this...? 2 28
These days socially coordinated efforts have turned into a critical requirement for enterprises.
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

770 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