Convert month number to month short name

Active3 hr before
Viewed126 times

6 Answers


possible duplicate of PHP convert month-number to short month-name – T.Todua Jul 21 '14 at 13:45 ,the first 4 numbers represent the year, and the last 2 numbers represent the month. I need to get the last 2 numbers in the month string name eg. Feb, Stack Overflow for Teams Where developers & technologists share private knowledge with coworkers , It's concise and simple, but isn't friendly for localization / internationalization. Better to use date() and get the month name in the user's language. Better still to let someone else write all our date code, because it's a Pandora's box. – Scott Lahteine Nov 16 '14 at 19:57

Append "01" and strtotime will be able to parse the string :

echo date('M', strtotime($month.
load more v

In MySQL, we can use a combination of functions ‘MONTHNAME’ and ‘STR_TO_DATE’ functions to get a month name from a month number.,In SQL SERVER, we can use a combination of functions ‘DATENAME’ and ‘DATEADD’ functions to get a month name from a month number.,In Oracle, we can use a combination of functions ‘TO_CHAR’ and ‘TO_DATE’ functions to get a month name from a month number.,We do not have a built-in function to convert month number to month directly in SQL. But we can use the combination of few different date functions to achieve this. Different databases have different built-in date functions.

# Month Name

-- -- -- -- -- -- -- -- --

# Month Name

-- -- -- -- -- -- --
load more v

let date = new Date(2020, 05, 21); // 2020-06-21
let longMonth = date.toLocaleString('en-us', {
   month: 'long'
}); /* June */
let shortMonth = date.toLocaleString('en-us', {
   month: 'short'
}); /* Jun */
let narrowMonth = date.toLocaleString('en-us', {
   month: 'narrow'
}); /* J */
load more v

In the input box just under ‘Type’ (on the right side of the dialog box), type the format “mmmm” if you want the full month name, or “mmm” if you want the abbreviated version of the month name.,Note: If you want the shorter version of the month name, like Jan, Feb, etc. then you can use the string parameter “mmm” instead of “mmmm”:,Note: As mentioned before, you can use the CHOOSE function to display the month in any custom format that you want, as long as you have the MONTH function with the cell reference to the date as the first parameter.,If you want to convert the date, which is in a cell, say A2, then you can use the CHOOSE function to display the month corresponding to the date, as follows:

Let’s say you have the number 5 in cell A2 and you want to convert it to the corresponding month name. You could use the TEXT function as follows:

= TEXT(A2, “mmmm”)
load more v

In this article, we will learn how to get a month name from a month number in Python. We will use some built-in modules available and some custom codes as well to see them working. Let's first have a quick look over what are dates in Python.,How to Get Month Name from Month Number in Python, Short name: Mar Full name: March,In this article, we learned to convert month numbers to month names by using datetime module, calender module, and Pandas library. We used some custom codes as well. We printed abbreviated month names as well as full months names. We get month numbers either as an input or by extracting from a date.

This method uses datetime module. The user gives the input for the month number. datetime.strptime() is called. It takes month number and month format "%m" as arguments. Passing "%b" to strftime returns abbreviated month name while using "%B" returns full month name.

import datetime

#provide month number
month_num = "3"
datetime_object = datetime.datetime.strptime(month_num, "%m")

month_name = datetime_object.strftime("%b")
print("Short name: ", month_name)

full_month_name = datetime_object.strftime("%B")
print("Full name: ", full_month_name)
load more v

The month number can be converted into a month name by using PHP functions. There are two functions to convert the given month number into month name.,How to convert number to month name in PHP?,How to convert a string into number in PHP?,How to call PHP function on the click of a Button ?


int mktime($hour, $minute, $second, $month, $day, $year, $is_dst)



DateTime::createFromFormat($format, $time, $timezone)
load more v

Other "number-convert" queries related to "Convert month number to month short name"