/** * Formatted Date * * Returns formatted date * * @param string $date * @param bool $displayTime If true shows date and time, if false only shows date * @param string $dateFormat Allows date and time formating using standard php syntax (http://php.net/manual/en/function.date.php) * * @return string */ function tribe_event_format_date($date, $displayTime = true, $dateFormat = '') { if (!TribeDateUtils::isTimestamp($date)) { $date = strtotime($date); } if ($dateFormat) { $format = $dateFormat; } else { $date_year = date('Y', $date); $cur_year = date('Y', current_time('timestamp')); // only show the year in the date if it's not in the current year $with_year = $date_year == $cur_year ? false : true; if ($displayTime) { $format = tribe_get_datetime_format($with_year); } else { $format = tribe_get_date_format($with_year); } } $date = date_i18n($format, $date); return apply_filters('tribe_event_formatted_date', $date, $displayTime, $dateFormat); }