Python Glossary Русский

all Python 3sqlite3function

sqlite3.TimeFromTicks()

DB-API: date and time

A DB-API standard function: takes only the time of day from seconds since the epoch and returns a datetime.time in the local time zone.

Syntax

sqlite3.TimeFromTicks(ticks)

The date is dropped and the fractional seconds are lost: TimeFromTicks(1.9) is 00:00:01 with no microseconds. The time comes from time.localtime, so machines in different zones get different results, and there is no tzinfo — you cannot tell afterwards which zone it was in.

Examples

import sqlite3
t = sqlite3.TimeFromTicks(3661.9)
print(t)  # → ? 01:01:01 в UTC, зависит от часового пояса
print(t.microsecond, t.tzinfo)  # → 0 None

See also

Open in the full glossarydocs.python.orgReport an inaccuracy