I would like to add a custom copyright footer to my site e.g. MONTH YEAR. I have set up a »short« date format for English, French and German in admin/config/regional/date-time/locale. Using <?php print format_date(time(), 'custom', t('F Y')); ?> in page.tpl.php is working great.

However I would love to go one step further. How do I print the short date format to page.tpl.php instead of adding them to *.tpl files separately?

  • Just <?php print format_date(time(), 'short'); ?>, is it what you want?
    – Jimmy Ko
    Jul 26, 2016 at 16:26
  • Yes, do I have to add the t() function for translation?
    – user32010
    Jul 26, 2016 at 16:32
  • 1
    Nope, it handles the language automatically as I explained in answer. Cheers.
    – Jimmy Ko
    Jul 26, 2016 at 16:42

1 Answer 1


You are right using the correct API format_date(). What you need to do is passing correct value to it.

<?php print format_date(time(), 'short'); ?>

According to the API doc, the function signature is:

format_date($timestamp, $type = 'medium', $format = '', $timezone = NULL, $langcode = NULL)

And it explained how you should handle the translation.

$langcode: (optional) Language code to translate to. Defaults to the language used to display the page.

$langcode is handled automatically if you keep it as default value.

  • Thank you, Jimmy Ko! This is exactly I was looking for. Now I am able to customize the date format for multiple languages.
    – user32010
    Jul 26, 2016 at 17:13

Your Answer

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