\WP_Stager_Integration\Calendar::format_event_time_label(int $start_timestamp, int $end_timestamp, array $args = array()): string
\WP_Stager_Integration\Calendar::format_event_time_label(int $start_timestamp, int $end_timestamp, array $args = array()): stringDescription
Formats event start and end times into a text label (e.g. "9:00 am - 8:00 pm").
Parameters:
| Parameter | Type | Description |
|---|---|---|
$start_timestamp | int | The start timestamp of the event |
$end_timestamp | int | The end timestamp of the event |
$args | array | (Optional) Additional arguments passed to the component template. |
Returns:
string A formatted event time label
Information
| File | class-calendar.php line 421 |
|---|
Full Code
/**
* Formats event start and end times into a text label (e.g. "9:00 am - 8:00 pm").
*
* @param int $start_timestamp The start timestamp of the event
* @param int $end_timestamp The end timestamp of the event
* @param array $args (Optional) Additional arguments passed to the component template.
*
* @return string A formatted event time label
*/
public static function format_event_time_label( $start_timestamp, $end_timestamp, $args = array() ) {
// Type casting
$start_timestamp = (int) $start_timestamp;
$end_timestamp = (int) $end_timestamp;
$args = (array) $args;
// Get time format
$time_format = (string) (get_option( 'time_format' ) ?: 'H:i');
// Define default label
$default = (string) wp_date( $time_format, $start_timestamp );
/**
* Filters the default calendar "event time" label text.
*
* @param string $label The label text
* @param int $start_timestamp The start timestamp of the event
* @param int $end_timestamp The end timestamp of the event
* @param array $args Additional arguments passed to the component template.
*
* @return string Must return a string
*/
$label = (string) apply_filters( 'wpstagerintegration_calendar_label_event_time', $default, $start_timestamp, $end_timestamp, $args );
return $label;
}💡 If you ever get stuck or have a question, please check our FAQs, our Free Integration Service, our paid Full Integration Service, or reach out to us!

Get WP Stager Integration
🎁 Limited offer: Use code WELCOME26 to get your first month for free!

