\WP_Stager_Integration\Calendar::calculate_timestamp_month_start(int $year, int $month): int
\WP_Stager_Integration\Calendar::calculate_timestamp_month_start(int $year, int $month): intDescription
Calculates the start timestamp of a given month (00:00:00 in the current site's timezone, first day of the month).
Parameters:
| Parameter | Type | Description |
|---|---|---|
$year | int | The year |
$month | int | The month (1-12) |
Returns:
int Unix timestamp for month start
Information
| File | class-calendar.php line 747 |
|---|
Full Code
/**
* Calculates the start timestamp of a given month (00:00:00 in the current site's timezone, first day of the month).
*
* @param int $year The year
* @param int $month The month (1-12)
*
* @return int Unix timestamp for month start
*/
public static function calculate_timestamp_month_start( $year, $month ) {
// Type casting
$year = (int) $year;
$month = (int) $month;
// Get first day of month timestamp
return (new \DateTimeImmutable( sprintf( '%d-%d-01 00:00:00', $year, $month ), wp_timezone() ))->getTimestamp();
}💡 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!

