wc_format_datetime( WC_DateTime $date, string $format = '' )

Format a date for output.


Description Description


Parameters Parameters

$date

(Required) Instance of WC_DateTime.

$format

(Optional) Data format. Defaults to the wc_date_format function if not set.

Default value: ''


Top ↑

Return Return

(string)


Top ↑

Source Source

File: includes/wc-formatting-functions.php

function wc_format_datetime( $date, $format = '' ) {
	if ( ! $format ) {
		$format = wc_date_format();
	}
	if ( ! is_a( $date, 'WC_DateTime' ) ) {
		return '';
	}
	return $date->date_i18n( $format );
}

Top ↑

Changelog Changelog

Changelog
Version Description
3.0.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.