lp__format_date( $date, $format, $timezone = 'Australia/Brisbane' )
Formats a date string according to the specified format and timezone.
Plugin
Namespace
Launchpad
Parameters
string
$date
The date value to be formatted.
string
$format
The desired date format.
string
$timezone
The timezone identifier. Default is ‘Australia/Brisbane’.
Return
string
The formatted date string.
Source
File: \includes\lp-utility-functions.php
function lp__format_date( $date, $format, $timezone = 'Australia/Brisbane' ) {
$timestamp = $date ? strtotime($date) : -1;
if ( $timestamp < 0 ) {
return false; // or return any fallback value you prefer
}
$formatted_date = date_i18n($format, $timestamp, false, $timezone);
return $formatted_date;
}