Skip to content

Commit b46728c

Browse files
committed
Add info about TIMEZONE types
1 parent 3bab8e3 commit b46728c

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

docs/usage-guide.txt

+22
Original file line numberDiff line numberDiff line change
@@ -1260,6 +1260,28 @@ determine encoding for conversions from/to `unicode`.
12601260

12611261
.. _working_with_blobs:
12621262

1263+
Working with TIME/TIMESTAMP WITH TIMEZONE
1264+
-----------------------------------------
1265+
1266+
Firebird 4 introduced support for TIME and TIMESTAMP WITH TIMEZONE. The driver supports these
1267+
types with timezone-aware `datetime.datetime` and `datetime.time` objects. However, this
1268+
support has some specific limitations:
1269+
1270+
1. The driver uses `python-dateutil` package to handle timezone information. Due to specific
1271+
requirements it's not possible to use standard `zoneinfo` package available in Python since
1272+
version 3.9, neither any other `datetime.tzinfo` implementation.
1273+
2. All timezone-aware `datetime.datetime` and `datetime.time` objects passed to the driver
1274+
must use `datetime.tzinfo` created with `.get_timezone()` utility function.
1275+
1276+
**Examples:**
1277+
1278+
.. sourcecode:: python
1279+
1280+
from firebird.driver import get_timezone
1281+
1282+
ts_region = datetime.datetime(2020, 12, 31, 23, 55, 35, 123400, get_timezone('Europe/Prague'))
1283+
ts_offset = datetime.datetime(2020, 12, 31, 23, 55, 35, 123400, get_timezone('+02:00'))
1284+
12631285
Working with BLOBs
12641286
------------------
12651287

0 commit comments

Comments
 (0)