Sandeep Pulikonda
Sandeep Pulikonda

Reputation: 776

How to get current month name in SSRS?

I need current month name as default perameter name in my ssrs report. How can I get current month name using an ssrs expression?

For example "27-09-2012" would become "September"
and one more i need....

27-09-2012 to previous month name as well (August)

Upvotes: 15

Views: 84446

Answers (4)

SHAMIM
SHAMIM

Reputation: 37

For Previous Month i found universal way : =MonthName(Month(CDate(Today()))-1,False) for SEPTEMBER (Full Month Name) 'OR' =MonthName(Month(CDate(Today()))-1,True) for SEP (Short Month Name)

Upvotes: 0

Turque
Turque

Reputation: 717

First question:

=MonthName(Month(Fields!datefield.Value))

Second question:

=MonthName(Month(DateAdd("m", -1, Today())))

I think the second question answer might be something like that, first converting the date to month then subtracting 1 from the month value and then converting it to month name.

Further reading:

OFF: I would change the date format you are using to 2012-09-27 as it works in every setting and should give you peace of mind when converting date formats.

Upvotes: 34

Michael Reck
Michael Reck

Reputation: 97

As a note, I tried the suggestion of =MonthName(Month(today())). What I would get is #error for whatever field the expression was in. However, =MonthName(str(Month(today()))) worked for me. I am unsure of whether or not the MonthName method changed to require a string or if it is some issue with my program. Just figured I would post this in case anyone else was having the same issue.

Upvotes: 2

Sammy
Sammy

Reputation: 61

Don't subtract 1 b/c it won't work for January. Use this: MonthName(Month(DateAdd("m", -1, CDate(Today))))

Upvotes: 6

Related Questions