wc_format_datetime()
Format a date for output.
No Hooks.
Returns
String.
Usage
wc_format_datetime( $date, $format );
- $date(WC_DateTime) (required)
- Instance of WC_DateTime.
- $format(string)
- Data format.
Default: wc_date_format function if not set
Changelog
| Since 3.0.0 | Introduced. |
wc_format_datetime() wc format datetime code WC 10.4.3
function wc_format_datetime( $date, $format = '' ) {
if ( ! $format ) {
$format = wc_date_format();
}
if ( ! is_a( $date, 'WC_DateTime' ) ) {
return '';
}
return $date->date_i18n( $format );
}