I'm still fairly new to Drupal, so I'm thinking there must be an obvious solution to this, and I just haven't found it yet. I've searched the forums, and the web in general, but no luck. How do I get my stories to show the posted date in the "long date" format?

I've gone to Home › Administer › Site configuration › Date and time , where it lets you choose your default long/medium/short formats, but how do you specify when and where to use long vs. medium vs. short? All my stories are displaying the medium format, and I just want to change it to long. I do have the Views module installed and enabled, but wasn't able to find a solution there either.

Comments

progga’s picture

It really depends on your theme. You can either add a separate node template file for the "story" type (node-story.tpl.php) and customize the date format inside that by calling format_date($created, 'long'). Alternatively you can put the following code in your theme's template.php file's _phptemplate_variables() function:

if ('node' === $hook AND 'story' === $vars['type']) {
    $vars['submitted'] = t('Submitted by !user on @time.',
                                    array('!user' => $vars['name'], '@time' => format_date($vars['created'], 'long')));
}

But then this might not work if the theme does not print $submitted in the node template file.

I am assuming you know PHP. Don't hesitate to ask if something is not clear. It is indeed a complicated issue for someone fairly new to Drupal :-(

JaclynMcKewan’s picture

Progga,

Thanks for the help.

And all this time I was thinking that the solution must be something obvious - since the "Date and Time" screen just lets you pick formats with a dropdown list, I had been thinking there must be a similar page somewhere for choosing when to use which type.

I only know a little PHP, but I'll take a look at your suggestions over the weekend and see what I can do.