You are here

function node_recur_format_date in Node recur 7

Helper function to display a start and end time together

Parameters

$start: A start datetime or timestamp

$end: An end datetime or timestamp

$format: The format type to use, sent to format_date()

Return value

A string of formatted dates

2 calls to node_recur_format_date()
node_recur_node_recur_confirm in ./node_recur.pages.inc
Confirm form for node recur
node_recur_node_recur_form in ./node_recur.pages.inc
The node recur form

File

./node_recur.module, line 624

Code

function node_recur_format_date($start, $end = NULL, $format = 'long') {
  $string = '';

  // Convert start to timestamp, if needed, then format
  $start = is_string($start) ? strtotime($start) : $start;
  $start = format_date($start, $format);
  $string .= $start;

  // Convert end to timestamp, if needed, then format
  if ($end) {
    $end = is_string($end) ? strtotime($end) : $end;
    $end = format_date($end, $format);
    if ($start != $end) {
      $string .= ' - ' . $end;
    }
    else {
      $string .= ' (' . t('All day') . ')';
    }
  }
  return $string;
}