0

I'm using Drupal 7 and Clean theme. And when created a node, show date top on node. No problem. But i want remove only hour and min. tab.

How can i solve this?

2 Answers 2

0

I would disable the created date display under the content type settings, and then just add a new date field whose display settings you can alter just like any other field.

The other option would be to change it by overriding hook_tokens in your theme. Specifically, you would override format_date($node->created, 'medium', '', NULL, $language_code); with your custom date format.

3
  • Yes maybe but i search easily way.
    – Karmacoma
    Jun 12, 2012 at 16:05
  • Where can i put this code?
    – Karmacoma
    Jun 12, 2012 at 16:13
  • You would probably want to create a custom theme. There's a theming guide on Drupal.org.
    – beth
    Jun 12, 2012 at 16:19
3

I think you want to have your node show June 12, 2012

If that is the case, you can do this:

function THEME_preprocess_node(&$variables) {
  if ($variables['submitted']) {
    $variables['submitted'] = t('Posted: !datetime', array( '!datetime' => format_date($variables['node']->created, 'custom', 'F j, Y')));
  }
}

Here's PHP documentation for date formats: http://php.net/manual/function.date.php

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.