1

I have created content type call person (list of persons) added a date field to content type (birth_date)

  1. how to split date to year/month (or should it be two date fields)
  2. how to link year to all the people born on that year and month/day to all people born on that day. I know how to create view, but how to make date output as link to it?

Pretty match like imdb does it, not display calendar but text in one line. birthday: year[link]/ month day[link]

0

Use module and code in your theme:

/**
 * Override theme_date_display_single().
 *
 * @param $variables
 *   An array of variables to pass to the theme template.
 */
function theme_date_display_single($variables) {
  if($variables['dates']['format'] == "d F Y"){
    // In this case i keep only start date. For keep end date use value2.
    $date = $variables['dates']['value']['formatted_iso'];
    $timezone = $variables['timezone'];
    $attributes = $variables['attributes'];

    $day = format_date(strtotime($date), 'custom', 'd');
    $month = format_date(strtotime($date), 'custom', 'F');
    $year = format_date(strtotime($date), 'custom', 'Y');

    // Wrap the result with the attributes.
    return '<span class="date-display-single"' . drupal_attributes($attributes) . '>' . '<span class="d">' . $day . '</span>' . '<span class="M">' . $month . '</span>' . '<span class="Y">' . $year . '</span>' . $timezone . '</span>';
  }
}

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.