4

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.

1 Answer 1

6

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.

1

Your Answer

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

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