Automattic\WooCommerce\Admin\API\Reports

TimeInterval::quarter()public staticWC 1.0

Returns quarter for the DateTime.

Method of the class: TimeInterval{}

No Hooks.

Return

Int|null.

Usage

$result = TimeInterval::quarter( $datetime );
$datetime(DateTime) (required)
Local date & time.

TimeInterval::quarter() code WC 8.6.1

public static function quarter( $datetime ) {
	switch ( (int) $datetime->format( 'm' ) ) {
		case 1:
		case 2:
		case 3:
			return 1;
		case 4:
		case 5:
		case 6:
			return 2;
		case 7:
		case 8:
		case 9:
			return 3;
		case 10:
		case 11:
		case 12:
			return 4;

	}
	return null;
}