\WP_Stager_Integration\Calendar::get_day_number(int $timestamp = null): int

Description

Get a formatted day number (1-31). Takes the site's timezone setting into account.

Parameters:

ParameterTypeDescription
$timestamp int (Optional) The Unix timestamp to get the number for. Defaults to current server time.

Returns:

int The day number (1-31)

Information

Fileclass-calendar.php line 233

Full Code

/**
 * Get a formatted day number (1-31). 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 day number (1-31)
 */
public static function get_day_number( $timestamp = null ) {

    // Type casting
    $timestamp = (int) ($timestamp ?: time());

    return (int) wp_date( 'j', $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!