WP_Locale::get_month() WordPress Method

The WP_Locale::get_month() function is used to get the month for a given month number. The function takes a single parameter, which is the month number. The function returns a string containing the month name.

WP_Locale::get_month( string|int $month_number ) #

Retrieves the full translated month by month number.


Description

The $month_number parameter has to be a string because it must have the ‘0’ in front of any number that is less than 10. Starts from ’01’ and ends at ’12’.

You can use an integer instead and it will add the ‘0’ before the numbers less than 10 for you.


Top ↑

Parameters

$month_number

(string|int)(Required)'01' through '12'.


Top ↑

Return

(string) Translated full month name.


Top ↑

Source

File: wp-includes/class-wp-locale.php

	public function get_month( $month_number ) {
		return $this->month[ zeroise( $month_number, 2 ) ];
	}


Top ↑

Changelog

Changelog
VersionDescription
2.1.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.