This document describes the scenarios that a GeneXus developer may face when installing or upgrading an application with TimeZone Support.
In a brand new installation there is no data in the Database. If you have to convert data from legacy systems, follow the steps described in "Upgrading an application" below.
If the application was generated using the Undefined value for Date Time storage timezone property, you cannot change it at installation time (see Changing the value of DateTime Storage property for exceptions).
If the application was generated using either UTC or Application server values for DateTime storage timezone property, you may change it if you need to. To do so, change the Application configuration file.
When upgrading an application, the main consideration is about Database data. Does it have to be converted or not? Is there a way to convert it?
The following table describes possible scenarios and the actions that may be required.
|Current Database Scenario
||Value of DateTime Storage TimeZone property in the new application
|All DateTime attributes are stored in the same Time Zone
||No conversion required.
||No conversion required
||You may either change the Application configuration file to match current data (UTC) or write and run a data conversion program (see below).
||You may either change the Application configuration file to match current data (Application Server) or write and run a data conversion program (see below).
||No conversion required
||Write and run a data conversion program (see below) that converts DateTime values from their TimeZone to UTC.
You can either:
- Write and run a data conversion program (see below) that converts DateTime values from their TimeZone to Application Server.
- Or change your server's TimeZone to match your existing data.
|The TimeZone of DateTime attributes is known but it may be different from attribute to attribute
||Write and run a data conversion program (see below) that converts DateTime values from their TimeZone to Application Server.
When upgrading your application from previous GeneXus versions or when changing the value of Date Time storage timezone property, you may need to write and run a conversion program to make all DateTime attributes of the database share a unique TimeZone (either UTC or Application Server).
Below is a program skeleton that guides you to write that conversion program. Just in case, remember to backup your database _before_ running the conversion program.
// Set the default timezone to UTC.
// If you need it to be a different one just change the parameter
// DateTimeAttribute is known to be in Timezones.New_York time zone.
// The following statement converts its value from New_York to UTC (value set by previous SetTimeZone command)
DateTimeAttribute = DateTimeAttribute.FromTimeZone( Timezones.New_York)
To improve update performance, you may want to take a look at Blocking Data Updates.