can't insert an RWDBDateTime object into the database, formatted as a UTC time.

Article ID: 1060
Last updated: 05 Feb, 2008
Article ID: 1060
Last updated: 05 Feb, 2008
Revision: 1
Views: 2934
Posted: 19 Aug, 1997
by Dean J.
Updated: 05 Feb, 2008
by Dean J.
Problem


It seems I can't insert an RWDBDateTime object into the database, formatted as a UTC time.


Cause


RWDBDatetime internally stores times in UTC time. However, when reading or writing this time to a database, it converts the time to the local time zone before (after) the write (read). This is to ensure compatibility with other systems, and seems to be the logical choice in some situations.

In some cases, however, it is useful to have the time stored in UTC format in the database, so the time is portable across time zones.


Action


Set local time to UTC time for writing the date into the database and reset it back for reading from the database.

RWZone::local(&RWZone::utc());

This article was:   Helpful | Not helpful
Report an issue
Article ID: 1060
Last updated: 05 Feb, 2008
Revision: 1
Views: 2934
Posted: 19 Aug, 1997 by Dean J.
Updated: 05 Feb, 2008 by Dean J.

Others in this category