Query |
Response | ||
All timestamps within our database are set as UTC. If we now want to show those to the end user via report, I want them to be in Local Time. While working with SSRS we used the function "=System.TimeZone.CurrentTimeZone().ToLocalTime(Fields!UTCBegin.Value)" Is there any equivalent we can use on the SyncFusion platform |
You can able to convert the timestamp values to the local time zone, using the below expression.
“=TimeZone.CurrentTimeZone.ToLocalTime(ReportItems!Textbox2.Value)”
We have prepared a simple report based on this and it can be downloaded from the below location.
| ||
is it possible to include the .NET functions by adding a reference to the report and if so, how?! |
The custom code support allows to use the .NET functions in reporting control. You can set the custom code for the report properties dialog box as described below.
1. Please click on the gray area of the report designer.
2 . Click the report properties and select the Code tab.
3 .Now, enter the below code as custom code to convert the timestamp values.
You can call this function from the required textbox using the following expression.
We have prepared a simple report based on this and it can be downloaded from the below location.
|
Thanks for your detailed reply and using the conversion now works for me!
Unfortunately I am now facing a similar problem: As all timestamps in the database are UTC based, and the user enters the preferred time range with two parameters (DT_From and DT_To), I have to convert those two timestamps from Local to UTC time. When I try to apply this in the filters section of the DataSet with the following expression
=TimeZone.CurrentTimeZone.ToUniversalTime(Parameters!DT_From.Value)
I get the an error message with sth. like this: Error while initialize the report: length may not be smaller than 0. Parameter name: length
What am I doing wrong?
Thanks!!