473,883 Members | 3,134 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to convert month number to month name

72 New Member
Hello and thanks you for your help

I’m trying to make my date field that looks like

1
2
3
4
5
6
7
8
9
10
11
12


To look like this

Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
Set
Oct
Nov
Dec

What formula would I use?

Thanks again Dave
May 23 '11 #1
4 14578
Stewart Ross
2,545 Recognized Expert Moderator Specialist
Dave, you almost answered it yourself in the title of your question. Use the MonthName function:

Expand|Select|Wrap|Line Numbers
  1. =MonthName(1) returns "Jan"
  2. =MonthName(2) returns "Feb"
  3. ...
  4. =MonthName(12) returns "Dec"
In an SQL statement you would use it like this:

Expand|Select|Wrap|Line Numbers
  1. SELECT MonthName([MonthNo]) as NameOfMonth, ..., FROM ...
-Stewart
May 23 '11 #2
ADezii
8,834 Recognized Expert Expert
@Stewart: Wouldn't you have to use the abbreviate Argument to the MonthName() Function in order to return the 3 Character Month, as in:
Expand|Select|Wrap|Line Numbers
  1. =MonthName(12,True)          'returns Dec
wheras
Expand|Select|Wrap|Line Numbers
  1. =MonthName(12)               'returns December
May 24 '11 #3
Stewart Ross
2,545 Recognized Expert Moderator Specialist
Oops - you are spot-on about the abbreviation requiring the additional parameter, ADezii.

Thanks

Stewart
May 24 '11 #4
NeoPa
32,584 Recognized Expert Moderator MVP
As a more general-purpose answer (for any format of any part of a date) you could use Format() :

Expand|Select|Wrap|Line Numbers
  1. SELECT Format([MonthNo] & '/9999', 'mmm') AS [Mth]
  2.      , ...
  3. FROM   ...
That's not to say using MonthName() is a bad idea at all. I just offer this for any who need a similar but different conversion using dates.
May 24 '11 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
2033
by: Mauro Baraldi | last post by:
Hello World ! Someone can help how to convert a number to it name. Well I'll explain... 11 -> leven. 48 -> forty eight. Something like it. Thanks
2
9724
by: Christopher Benson-Manica | last post by:
What would be the best way to convert a month number to its corresponding string? I.e, 3 -> 'March'. Is there a builtin function or must I use a lookup table or something? -- Christopher Benson-Manica | I *should* know what I'm talking about - if I ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
1
3216
by: Wayfarer | last post by:
I've built a report using a aggregate query that is grouped by Month + Year, Program and Name. When I feed the date ranges as query parameters, it will very properly print out a report that shows a separate page for each program by month with the names of the folks in that program. So far, so good... But what I need to complete the report is a summary page for the entire date range in the same format. I have no &%^# idea how to do that....
7
7131
by: whatluo | last post by:
Hi, all I'm now working on a program which will convert dec number to hex and oct and bin respectively, I've checked the clc but with no luck, so can anybody give me a hit how to make this done without strtol or s/printf function. Thanks, whatluo.
10
7345
by: Bill | last post by:
Hello -- I'm parsing the output of the finger command, and was wondering something...If I'm given a month abbrievation (such as "Jan"), what's the best way to figure out the month number? I see that there's something called "month_abbr" in the calendar module. However, when I try to do calendar.month_abbr.index("Jan"), I get "_localized_month instance has no attribute 'index'." So it seems that month_abbr isn't a regular list. I'm...
3
34831
by: Aussie Rules | last post by:
Hi, How do I extract just the month part of a date. Say for example I wanted to get the value of 6 (as in sixth month) from todays date. Regards
2
26576
by: CindySue | last post by:
Hello--I've got a query that uses DatePart("m",) to select records for a particular month, and then a report based on that query. I'd like to be able to create a field in the report that says what month they are for. I can get the month number by using =DatePart("m",) in a text box, but I can't find a way to convert it to the month name. I've experimented with a couple of things I found in the forum, but I'm not talented enough to get them to...
5
14465
by: girl23 | last post by:
I am using a function prototype to convert month number to month name. basically you ask the compiler to enter int from 1 to 12 and then convert it. printMonth ( number ); is the prototype and using switch this is what i did case 'm': printf( "What month? Enter a number between 1 and 12: " ); scanf( "%d%c", &number, &tmp ); printMonth( number ); break;
12
23233
by: Be Borth | last post by:
I saw previous solutions to convert a month number (1) to a month name (January). I have a database with 200+ dates. In a query, I use the "Part" function DatePart("m",), to extract the month (number) and all month extracts worked correctly (they returned the correct numerical month). However, when I attempted adding a field in the query to format that extracted month to a month name, it only returned January and December - for all 200+...
3
3085
antonopn
by: antonopn | last post by:
Hello to all! I'm trying to make a very difficult report. I want to present sales of some products within an year but month-to-month. lets say that the table would be like this... customer|specie|quantityJAN|quantityFEB|quantityMAR... But the problem is I need to make all these columns by hand and the query is like this...
0
9944
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9797
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11154
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10863
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10422
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9586
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7977
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6005
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4228
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.