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;

}

Related

Use to convert a string to a valid phone number.

Use to parse an array serialized as a string and returns it as a concatenated string.

Use to escape single quotes in a string.

Use to convert the first character of each word in a string to uppercase.