469,336 Members | 5,233 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,336 developers. It's quick & easy.

How to convert month number to month name

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 13661
Stewart Ross
2,545 Expert Mod 2GB
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,800 Expert 8TB
@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 Expert Mod 2GB
Oops - you are spot-on about the abbreviation requiring the additional parameter, ADezii.

Thanks

Stewart
May 24 '11 #4
NeoPa
32,182 Expert Mod 16PB
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

Post your reply

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

Similar topics

2 posts views Thread by Mauro Baraldi | last post: by
2 posts views Thread by Christopher Benson-Manica | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by haryvincent176 | last post: by
reply views Thread by Marylou17 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.