Server Event: Adjust foreign times to local time

This server event adjusts report data from a foreign time zone to the local time. The example uses the Server Time Zone Offset setting in the Culture Settings to adjust the time. Date fields are hard-coded.

Global Event: OnDataCombined


  • System.Data.dll,
  • System.xml.dll


  • System.Data,
  • WebReports.Api.Common


DataTable table = args[0] as DataTable;

// retrieve the server time zone offset setting
decimal? offset = sessionInfo.SetupData.General.ServerTimeZoneOffset;

// check if the offset is null or zero in which case no change is needed
if (!offset.HasValue || offset == 0)
	return table;

// find any desired DateTime columns. Adjust their time using AddHours
string[] dateFields = {

foreach (string dateField in dateFields)
    if (table.Columns.Contains(dateField))
        foreach (DataRow row in table.Rows)
            row[dateField] = Convert.ToDateTime(row[dateField]).AddHours((double) offset);
return table;

Hidden Article Information

Article Author
Exago Development
created 2016-08-23 16:37:53 UTC
updated 2017-06-19 17:56:16 UTC

time zone, SAE, server event, events, example, time, local, culture,
Have more questions? Submit a request