Monday, March 26, 2012

Formatting the date on report

Reporting Services 2005 (SQL Server 2005 CTP V 9.00.1187.00)

I have a date field and I want to format it on a report like:

January 9, 2006

Seems to me that should be pretty simple. But I can't find the correct format code. If I look at the textbox properties and go to the format tab, there is an option for Date, but there are only 3 choices:

1/9/2006 9:47 AM

Monday, January 9, 2006

1/9/2006

If I choose custom I found that Y gives me:

January 2006

and M gives me:

January 09

This is rather frustrating. I'm sure I could modify my source SQL to get each part of the date and past it together, but I would think a good reporting tool would give me the option on how to format the date, so I don't have to always modify the SQL. I've searched for help on the different format options and I can't find any.

Any help would be very much appreciated.

Thanks.

Well, I finally figured it out, with the help of some obscure posting on another forum. I now use format:

MMMM dd"," yyyy

interesting that you have to use MMMM, not mmmm and you have to use yyyy, not YYYY.

Now I could not find this anywhere in the documentation. I'm sure it must be there, but where? Does anybody know? I'm sure I'm going to have other formatting issues and I really don't want to have to search through forum postings on the internet to find crumbs of clues to figure out things that I think should be easily found in the products documentation. I'm sure it's me. It's gotta be right in front of me, or I did something wrong when installing and I don't have the correct documentation. (but then why can't I find it at MSDN?)

|||

You can find documentation about these custom .NET format strings (e.g. MMMM and yyyy) on MSDN: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconcustomdatetimeformatstrings.asp

-- Robert

|||Thanks!

No comments:

Post a Comment