WordPress at a glance
function is not described

Automattic\WooCommerce\Admin\API\Reports

TimeInterval::week_number() public WC 1.0

Returns ISO 8601 week number for the DateTime, if week starts on Monday, otherwise returns simple week number.

{} It's a method of the class: TimeInterval{}

No Hooks.

Return

Int. Nothing.

Usage

$result = TimeInterval::week_number( $datetime, $first_day_of_week );
$datetime(DateTime) (required)
Local date for which the week number is to be calculated.
$first_day_of_week(int) (required)
0 for Sunday to 6 for Saturday.

Notes

  • See: TimeInterval::simple_week_number()

Code of TimeInterval::week_number() WC 5.3.0

<?php
public static function week_number( $datetime, $first_day_of_week ) {
	if ( 1 === $first_day_of_week ) {
		$week_number = (int) $datetime->format( 'W' );
	} else {
		$week_number = self::simple_week_number( $datetime, $first_day_of_week );
	}
	return $week_number;
}