\WP_Stager_Integration\Calendar::get_week_number(int $timestamp = null): int
\WP_Stager_Integration\Calendar::get_week_number(int $timestamp = null): intDescription
Get a formatted week number (1-53). Takes the site's timezone setting into account.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$timestamp | int | (Optional) The Unix timestamp to get the number for. Defaults to current server time. |
Returns:
int The week number (1-53)
Information
| File | class-calendar.php line 218 |
|---|
Full Code
/**
* Get a formatted week number (1-53). Takes the site's timezone setting into account.
*
* @param int $timestamp (Optional) The Unix timestamp to get the number for. Defaults to current server time.
*
* @return int The week number (1-53)
*/
public static function get_week_number( $timestamp = null ) {
// Type casting
$timestamp = (int) ($timestamp ?: time());
return (int) wp_date( 'W', $timestamp );
}💡 If you ever get stuck or have a question, please check our FAQs, our Free Integration Service, our paid Full Integration Service, or reach out to us!

Get WP Stager Integration
🎁 Limited offer: Use code WELCOME26 to get your first month for free!

