RWDateTime
Class RWDateTime, also contained in the Essential Tools Module, is the primary class used for dates and times in the DB Interface Module. This class serves as a compact representation for calendar calculations. It shields you from many of the details of programming with time elements, like leap years, and performs conversions to and from conventional calendar formats.
SourcePro DB compatibility is provided to RWDateTime instances that are initialized to either RWDateTime::null or a valid date. For a full discussion of the many features of this class, please see the Essential Tools Module User's Guide and the SourcePro API Reference Guide.
When RWDateTime is used to either write or extract data to or from a database, by default it uses the local time zone represented by RWZone::local(). Methods on RWDBDatabase and RWDBConnection allow you to specify a different time zone.
 
const RWZone* RWDBDatabase::timeZone(const RWZone* zone)
const RWZone& RWDBDatabase::timeZone() const
The first method sets the time zone on the RWDBDatabase instance, and all RWDBConnection instances produced by it after the time zone is set. The RWDBDatabase instance retains a reference to the time zone, hence it is the application's responsibility to ensure that the time zone has a lifetime greater than the RWDBDatabase instance or any object produced from it. The second method allows you to determine the current setting for this RWDBDatabase.
 
const RWZone* RWDBConnection::timeZone(const RWZone* zone)
const RWZone& RWDBConnection::timeZone() const
The first method sets the time zone for the specific RWDBConnection instance. The RWDBConnection instance retains a reference to the time zone, hence it is the application's responsibility to ensure that the time zone has a lifetime greater than the RWDBConnection instance or any object using it. The second method allows you to determine the current setting for this RWDBConnection.
NOTE: If the database client you are using provides a time zone setting on its connections, the above methods do not set or get those time zone settings. If you wish to get or set the time zone setting on the database client connection, you can do so by executing the database-specific SQL for getting or setting the time zone using RWDBConnection::executeSql().