views:

950

answers:

3

I have 2 fields in the database month (numeric) and year (numeric) and I want to combine them in a report that combines those 2 fields and format them with MMM-YYYY. e.g 7-2008 becomes Jul-2008. How do I do that?

A: 

=DateSerial(year, month, day)

Tomas
That's not recognised in T-SQL nor SSRS....
TheObserver
+1  A: 

DateSerial is the correct answer:

http://msdn.microsoft.com/en-us/library/bbx05d0c(VS.80).aspx

SSRS uses VB.Net for expressions. Use the expression editor to browse the available functions, one of which is DateSerial.

To format the date, set the Format property on the textbox. You should be able to use "MMM-yyyy" as the format.

Update: As Peter points out, you would specify the parameters as needed. If you just care about year and month, just supply a value of 1 for the day. Since you are formatting the value without the day component it really doesn't matter what value you use (as long as it creates a valid date).

Brannon
A: 

Brannon's answer is correct except that he omits the fact that you merely specify a literal for the day. Any value between 1 and 28 will do.

Peter Wone