Question

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?

Was it helpful?

Solution

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).

OTHER TIPS

=DateSerial(year, month, day)

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top