inserting/retriving dates in psycopg

Michele Simionato michele.simionato at
Thu Jan 5 03:11:31 EST 2006

Frank Millman:

> import datetime as dt

> def DbToDate(dat):
>    if isinstance(dat,dt.datetime):
>        return dat  # already in datetime format
>    if isinstance(dat,
>        return dt.datetime.combine(dat,dt.time(0))  # convert to datetime

This is exactly the type checking I would like to avoid :-/

            Michele Simionato

More information about the Python-list mailing list