WC_API_Coupons::get_coupon_expiry_date()protectedWC 2.3.0

expiry_date format

Method of the class: WC_API_Coupons{}

No Hooks.

Return

String|Int.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_coupon_expiry_date( $expiry_date, $as_timestamp );
$expiry_date(string) (required)
-
$as_timestamp(true|false)
(default: false)
Default: false

Changelog

Since 2.3.0 Introduced.

WC_API_Coupons::get_coupon_expiry_date() code WC 8.7.0

protected function get_coupon_expiry_date( $expiry_date, $as_timestamp = false ) {
	if ( '' != $expiry_date ) {
		if ( $as_timestamp ) {
			return strtotime( $expiry_date );
		}

		return date( 'Y-m-d', strtotime( $expiry_date ) );
	}

	return '';
}