Solved

Changing date format in a drupal template

Posted on 2014-02-28
3
409 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 110

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 110

Expert Comment

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

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Compiling PHP with Curl plus protocols 8 48
Building a glossary into your website 9 58
PHP $_POST vs asp request 4 57
PHP processing webform 25 45
These days socially coordinated efforts have turned into a critical requirement for enterprises.
This article discusses how to create an extensible mechanism for linked drop downs.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

738 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