Tell me more ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I am theming a node where I need to show the created date. Since Drupal stores it as timestamp, what is the best method to retrieve it? I have found this post: http://drupal.org/node/101993. But the problem is that whe using this...

<?php 
print date("D, j M, Y \a\\t G:i", $node->changed);
?>

... it delivers me the content in English. My portal default language is Portuguese. Is there a Drupal function that will deliver the timestamp as a regular date that takes into account the user's selected language? And that maybe takes into account the preformatted dates set in the portal configuration? Thank you.

share|improve this question

1 Answer

up vote 5 down vote accepted

Instead of date(), try using format_date()

It has an otional last parameter $langcode that tells it what language code to use for the date.

share|improve this answer
Yes, thank you, I found the documentation here: api.drupal.org/api/drupal/includes--common.inc/function/… – Marcos Buarque Apr 7 '11 at 18:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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