How can i wrap date elements in this function?

function theme_date_display_single($variables) {
    $date = $variables['date'];
    $timezone = $variables['timezone'];
    $attributes = $variables['attributes'];
// Wrap the result with the attributes.
    return '<span class="date-display-single"' . drupal_attributes($attributes) . '>' . $date . $timezone . '</span>';

I think i can call $date with some parametrs, but don't which. I want something like:

return '<span class="date-display-single"' . drupal_attributes($attributes) . '> <label class="day">'. $day. '</label> <label class="month">'. $month. '</label>' . $timezone . '</span>';

Hope this will help you,

In Drupal 7 you can use Custom Formatters module for your requirement.


  • Install and enable Custom Formatters and TOKEN module
  • Create you own format using admin/structure/formatters

    enter image description here

  • Use the available TOKENS

    enter image description here

  • Use TOKEN and HTML TAGS to create new format

    enter image description here

  • After creating the new format

    enter image description here

  • Use the new date format where you want to show

    enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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