=Format(Month(Date()),"mmmm") returning wrong month!

  • Thread starter Pascoe via AccessMonster.com
  • Start date
P

Pascoe via AccessMonster.com

Hi there!

I'm having a rather strange problem - can you help

=Month(Date()) returns the value 12, which is good as it is currently
December.

=Format(Month(Date()),"mmmm") returns the value January which is not so good..
 
J

jag2004

"mmmm" returns the full name of the month.

Not sure what you are using which is causing it to display January?

/ Date separator.
c Same as the General Date predefined format.
d Day of the month in one or two numeric digits, as needed (1 to 31).
dd Day of the month in two numeric digits (01 to 31).
ddd First three letters of the weekday (Sun to Sat).
dddd Full name of the weekday (Sunday to Saturday).
ddddd Same as the Short Date predefined format.
dddddd Same as the Long Date predefined format.
w Day of the week (1 to 7).
ww Week of the year (1 to 53).
m Month of the year in one or two numeric digits, as needed (1 to
12).
mm Month of the year in two numeric digits (01 to 12).
mmm First three letters of the month (Jan to Dec).
mmmm Full name of the month (January to December).
q Date displayed as the quarter of the year (1 to 4).
y Number of the day of the year (1 to 366).
yy Last two digits of the year (01 to 99).
yyyy Full year (0100 to 9999).
 
A

atlantis43 via AccessMonster.com

Just leave the quotes off of mmmm and problem will be solved
 
D

Dirk Goldgar

Pascoe via AccessMonster.com said:
Hi there!

I'm having a rather strange problem - can you help

=Month(Date()) returns the value 12, which is good as it is currently
December.

=Format(Month(Date()),"mmmm") returns the value January which is not so
good..


If you want to pass the month number and get the month name, use the
MonthName function:

?MonthName(12)
December

Or just pass the date with your format string:

?Format(Date(), "mmmm")
December

If you use one of the date format strings (such as "mmmm"), the first
argument to the Format function is assumed to be a date/time value, not an
integer month number. The date/time value of the number 12 would be 12 days
from the "zero date" of the date/time data type (which is December 30,
1899). 12 days after December 30 is January 11. For confirmation, look at
this:

?Format(12, "long date")
Thursday, January 11, 1900
 
R

Rick Brandt

Hi there!

I'm having a rather strange problem - can you help

=Month(Date()) returns the value 12, which is good as it is currently
December.

=Format(Month(Date()),"mmmm") returns the value January which is not so
good..


Month(Date()) returns the number 12. The number 12 as a date is equal to
January 11, 1900. Thus you get January when you format that date to get
the month.
 
P

Pascoe via AccessMonster.com

Thank you to everybody thaty replied, particularly Dick Goldgar who actually
answered my question, and who's solution worked!

Happy Christmas!
Russell.

Rick said:
Hi there!
[quoted text clipped - 5 lines]
=Format(Month(Date()),"mmmm") returns the value January which is not so
good..

Month(Date()) returns the number 12. The number 12 as a date is equal to
January 11, 1900. Thus you get January when you format that date to get
the month.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top