\WP_Stager_Integration\Calendar::get_month_number(int $timestamp = null): int
\WP_Stager_Integration\Calendar::get_month_number(int $timestamp = null): intDescription
Get a formatted month number (1-12). 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 month number (1-12)
Information
| File | class-calendar.php line 203 |
|---|
Full Code
/**
* Get a formatted month number (1-12). 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 month number (1-12)
*/
public static function get_month_number( $timestamp = null ) {
// Type casting
$timestamp = (int) ($timestamp ?: time());
return (int) wp_date( 'n', $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!

