Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Formatting Dates Expand / Collapse
Author
Message
Posted Tuesday, August 10, 2010 12:09 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Tuesday, July 29, 2014 1:01 AM
Points: 15, Visits: 140
Refers to issues with SQL Server 2005 Reporting Services (I am not sure if this occurs in the 2008 reincarnation)

Requirement: I would like to display dates in dd-MMM-yyyy format.

Problem: Column used for display in a SSRS report is a datetime. I right-clicked on the relevant text box, selected Properties and then the Format tab, clicked fx and typed the expression
=Format (<datetime field from dataset>, "dd-MMM-yyyy").

The above gives months as "Jan", "eb", "3ar", "Apr", "5a10", "Jun", "Jul", "AuA.D.", "Sep", "OcP", "Nov", "Dec".

Cure: DO not use the FORMAT tab of Text box Properties. On right-click of the Text box, click on Expression instead, and enter the expression here, as in:
=format(Fields!LastBackupStart.Value, "dd-MMM-yyyy HH:mm:ss")

Seems to work OK. Hope this helps anyone tearing their hair out ....
Post #966373
Posted Tuesday, August 10, 2010 3:49 AM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Thursday, July 31, 2014 5:24 PM
Points: 1,595, Visits: 6,615
You are using the wrong expression for the format. Given a date of 2/3/2009, your expression
=Format (<datetime field from dataset>, "dd-MMM-yyyy"). 

evaluates to "3-Feb-2009" which is then used to format the date, which results in 03-2eb-2009.

Simply enter dd-MMM-yyyy in the format textbox or use expression ="dd-MMM-yyyy" will fix the problem.

Peter
Post #966486
Posted Tuesday, August 10, 2010 5:17 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Tuesday, July 29, 2014 1:01 AM
Points: 15, Visits: 140
Thank you for that - you've pointed me in the right direction
Post #967069
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse