[DB-SIG] Date/Time confusion in spec
zen at shangri-la.dropbear.id.au
Thu Oct 9 04:39:48 EDT 2003
-----BEGIN PGP SIGNED MESSAGE-----
The DBAPI 2.0 spec does not mention if the parameters to
the Date(), Time() or Timestamp() constructors wants times
in the local time zone, in UTC, or a naive time.
DateFromTicks(), TimeFromTicks() and TimestampFromTicks()
use epoch time, which is UTC.
This seems an important point. If Timestamp() wants UTC or local
time, it is all unambiguous if we know which. If Timestamp() is
timezone naive, then either the backend needs to be able to support
both naive and TZ aware timestamps, or the *FromTicks() constructors
need to convert the ticks to the local time zone. Does this sound
Currently there are constructors for creating DATETIME objects.
However, there is no way of converting back into some known format.
So although I can insert timestamps into a database without knowing
about the drivers particular DATETIME implementation (mxDateTime?
Python datetime? An ISO8601 string?), I can't retrieve and process
A sane way of addressing this would be another constructor be added
to the API, taking a driver specific DATETIME and returning something
known (eg. epoch time or a tuple as per the standard time module).
Stuart Bishop <stuart at stuartbishop.net>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (Darwin)
-----END PGP SIGNATURE-----
More information about the DB-SIG