Friday, February 24, 2012

Format Date in Reports

Dear friends

I have a problem with the format date, because my database has the format yyyy/mm/dd and in the computer user's the default configuration of date is dd/mm/yyyy, the problem exists with the reports that have the parameter of date type, the users input dd/mm/yyyy and the report request error in the format.

My question is, how do i make the any format input the users, i change in the report for this recieve the format yyyy/mm/dd, where is the parameter i have to change, the easy request is i have change the configuration of computer users, but i dont have this.

Thank you

Dear ,

U can try it like this

If u have a mtrix set report

=Day(First(Fields!OrderDate.Value, "MatrixSource"))& "/" & month(First(Fields!OrderDate.Value, "MatrixSource"))& "/" & year(First(Fields!OrderDate.Value, "MatrixSource"))

If not then remove the matrixsource text from the foruma

|||

Thank you for your response, but how use this code in the parameters, because my problem is whit the parameter, the users input dd/mm/yyyy, but my database is configurate in yyyy/mm/dd, i don't know how i make this change from parameters to store procedure who is that recive the parameters.

Thank you

|||You can do the conversion in the stored procedure using the CAST or CONVERT functions (or in the command text, depending on the command text). Or you could convert it before hand in the expression for the query parameter value using the DateTime.Parse method along with ToString("yyyy\mm\dd"). For example,

=DateTime.Parse(ReportParameters!DateParam.Value, New CultureInfo("fr-FR", False)).ToString("yyyy/mm/dd")

For more information:
http://msdn2.microsoft.com/en-us/library/kc8s65zs.aspx

For more information on CAST and CONVERT:
http://msdn2.microsoft.com/en-us/library/ms187928.aspx

Ian

No comments:

Post a Comment