Change Date format to YYYY-MM-DD in SSRS report .

Hi Gurus,

I have a report designed. The data source for this report is cube. I have a column called date in this report. The present format of the report is MM-DD-YYYY. I want that to be displayed in YYYY-MM-DD format. I played with the textbox properties and expression but it still giving me the same result. Can anyone guide me with this please.
HeroOfSpartaAsked:
Who is Participating?
 
Jason Yousef, MSConnect With a Mentor Sr. BI  DeveloperCommented:
Alright 2 ways...

The easy way.....

=Format( Fields!BadDate.Value ,"yyyy-MM-dd")

=Format(CDATE( Fields!BadDate.Value ),"yyyy-MM-dd")


The hard way.....

=Year(CDATE(Fields!BadDate.Value))&"-"&Month(CDATE(Fields!BadDate.Value))&"-"&Day(CDATE(Fields!BadDate.Value))


Also good to mention to replace "Fields!BadDate.Value" with your actual column name :)

Regards,
Jason
0
 
Patrick TallaricoFSEP Systems AnalystCommented:
can you adjust the underlying query to use a converted date?

...convert(120, datefield)...

http://msdn.microsoft.com/en-us/library/ms187928.aspx
0
 
HeroOfSpartaAuthor Commented:
Thanks for you reply. But I am extracting from cube and not from the table. I am not sure if I can use above query in my case. I am wrong please explain me in detail .
0
 
HeroOfSpartaAuthor Commented:
Thank you verymuch Jason. The expression worked out is : Incase anyone having same problem.

=Format(CDATE( Fields!BadDate.Value ),"yyyy-MM-dd")

Note: I did not tried the hard way yet. As everyone wants easy way :)
0
 
Jason Yousef, MSSr. BI  DeveloperCommented:
Glad that it helped you, see you in another SSRS question :)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.