views:

265

answers:

2

I get report params in C# code from the webservice as follows:

ReportingService2005 ReportingService = ConnectToSSRS();
ReportParameter[] ReportParams = ReportingService.GetReportParameters(reportSelector.SelectedValue, HistoryID, ForRendering, emptyParams, null);

DateTime parameters currently seem to always come up as mm/dd/yyyy. Where is the date format defined? It's not hardcoded like this is it? Is there a way for me to obtain the DateFormat from code?

Thanks

A: 

What you're seeing is the default format string representation of the DateTime object (according to your locale...probably), so yes, in a sense, it is harcoded like that.

If you're working with a DateTime object though, rather than try and figure out what format it is in, you could just force it to whatever format you like best.

dt.ToString("MM/dd/yyyy hh:mm:sszzz")

You might want to take a look here for information that might help you. Also this.

carrier
Using a DateTime object won't change anything. The report server is accessed via a SOAP interface. The ReportParameter object is basically just Name-Value pairs where the value is a string. I need to know how to format my string by knowing what the locale of the server is.
Mr Grieves
...DateTime can parse the strings for me, and I intend to use it, but it can only parse things correctly if the correct locale is set.
Mr Grieves
A: 

Try to use ISO 8601 date format, e.g. 1999-06-01. It will work.

BZ
You mean for sending dates to server?I'm still left with the problem of correctly parsing dates sent to my client by the server. Right now it seems to be spitting out mm/dd/yyyy. When I deploy to other servers, will this always be true? Or even with different reports? Where did mm/dd/yyyy come from? If someone can show me that it's hard coded (in documentation), then I'll be at peace with hardcoding my client.
Mr Grieves