Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Analysis Server and Reporting Services (2005)
 Change Date Format

Author  Topic 

CoachBarker
Posting Yak Master

170 Posts

Posted - 2009-01-03 : 03:29:00
I have a date stored in a database and returned as yyyyMMdd (please don't ask why)in the report I need to reformat it as yyyy/MM/dd, how can I do this?

Thanks for the help
CoachBarker

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-01-03 : 07:03:28
you can right click on the cell displaying date and choose properties. in format tab, you can choose datatype as date and choose format you want.
Go to Top of Page

CoachBarker
Posting Yak Master

170 Posts

Posted - 2009-01-12 : 12:57:06
I tried and other values and the format never changes, it remains yyyyMMdd (20080901) instead of 2008/09/01.

Thanks for the help
CoachBarker
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-01-12 : 12:59:40
is the database field of type datetime? else you may have to use formatdatetime() function available in ssrs
Go to Top of Page

CoachBarker
Posting Yak Master

170 Posts

Posted - 2009-01-12 : 15:31:52
no the datatype is set as char(8). In the data base the field is stored as 20080918. In the report they want it to display as2008/09/18. Nothing I have tried changes the appearance in the report.

Thanks for the help
CoachBarker
Go to Top of Page

revelator
Starting Member

32 Posts

Posted - 2009-01-13 : 04:39:45
Change the column datatype to datetime in the SP or SQL statement being used in the report. Eg...

select cast(DateStamp as datetime) as DateStamp from YourTable

Then in the report, use an expression to format the data. Eg...

=format(Fields!DateStamp.Value,"yyyy/MM/dd")



-----------------------------------
Waiting for the Great Leap Forwards
Go to Top of Page

CoachBarker
Posting Yak Master

170 Posts

Posted - 2009-01-13 : 14:15:14
Thanks, I never knew you could cast in an SQL statement, worked like a charm.

Thanks for the help
CoachBarker
Go to Top of Page
   

- Advertisement -