1
votes

i'm trying to specify dd/mm/yyyy dateformat for date/time parameter in SSRS 2008 R2. My computers datetime format is mm-dd-yyyy.

My requirement is, i want to show date format at dd/mm/yyyy irrespective of the system/server date format. I've already tried CDate(Format(Today,"dd/mm/yyyy")) which didn't work. one very strange thing i observed is, it shows dd/mm/yyyy format only for dates on or before 12-MM-yyyy, and 13 onwards it gives error: Conversion from string '25-04-2014' to type Date is not valid. (Possibly it is trying to map 25(daypart) with MM-dd-yyyy (month part)) which is out of range of total months i.e. 12)

my research on internet says it is a bug in BIDS 2008. What do i do to display date as dd/mm/yyyy ??

2
=format(Today(),"dd/MM/yyyy"), this works fine. Re check.Aditya
i did try that, it gives error: conversion from string to date type is not valid.Ajeetkumar
If i am not wrong, you are putting date column in the place of Today(). Possibly your date column data type is String.Aditya
I'm conscious about it. it is date/time.Ajeetkumar
I am using Visual Studio 2010, Reporting Services 2012 & it works just fine. Just try with the expression as it is, setting it to a textbox expression or value property. It should work, I have tested & am conscious about that.Aditya

2 Answers

2
votes

I don't have enough reputation to comment, but I did notice that you failed to put "()" after "Today". If I'm not mistaken you must put Today() for that function to work. Also, you might want to try putting CDate Around the Today() function. You shouldn't need it, but it's worth a shot. Also, for some odd reason, in my experience, you must capitalize MM for format to work correctly. Like @Aditaya said, it should be =format(Today(),"dd/MM/yyyy")

0
votes

The expression I usually use is:

=FormatDateTime(Fields!Date.Value, DateFormat.ShortDate)

However, this may be region specific.

Rather than writing an expression to do the formatting, you can also use the Textbox Format Property. But first you need to make sure that the data is in a date format. So use the CDate function on your column like this:

=CDate(Fields!Date.Value)

Then in the textbox properties go to the Number tab. Select Date for the category. Then you can select whichever format you want or use a Custom format. This will change how the column displays when you run the report.