Skip to content

Commit c4dde48

Browse files
Nit
1 parent 0b6f381 commit c4dde48

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Doc/library/sqlite3.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1336,29 +1336,30 @@ timestamp converter.
13361336
Adapter and Converter Recipes
13371337
-----------------------------
13381338

1339-
This section shows recipes for common adapters and converters.
1339+
This section shows recipes for timezone-naive adapters and converters.
13401340

13411341
.. testcode::
13421342

13431343
import sqlite3
13441344

1345-
# Timezone-naive datetime adapters and converters.
13461345
def adapt_date(val):
13471346
return val.isoformat()
13481347

13491348
def adapt_datetime(val):
13501349
return val.isoformat(" ")
13511350

13521351
def convert_date(val):
1352+
import datetime
13531353
return datetime.date(*map(int, val.split(b"-")))
13541354
13551355
def convert_timestamp(val):
1356+
import datetime
13561357
datepart, timepart = val.split(b" ")
13571358
year, month, day = map(int, datepart.split(b"-"))
13581359
timepart_full = timepart.split(b".")
13591360
hours, minutes, seconds = map(int, timepart_full[0].split(b":"))
13601361
if len(timepart_full) == 2:
1361-
microseconds = int('{:0<6.6}'.format(timepart_full[1].decode()))
1362+
microseconds = int("{:0<6.6}".format(timepart_full[1].decode()))
13621363
else:
13631364
microseconds = 0
13641365

0 commit comments

Comments
 (0)