Frank Millan:
> Perhaps if you explain what you are trying to do, I may be able to
> suggest something.
I am looking for an adaptation/type cast mechanism and looking at the
sources I think I have
found it in doc/examples/usercast.py. I am doing some experiment now
...
Michele Simionato
--
h
Michele Simionato wrote:
> Frank Millman:
>
> > import datetime as dt
>
> > def DbToDate(dat):
> >if isinstance(dat,dt.datetime):
> >return dat # already in datetime format
> >if isinstance(dat,dt.date):
> >return dt.datetime.combine(dat,dt.time(0)) # convert to datetime
Frank Millman:
> import datetime as dt
> def DbToDate(dat):
>if isinstance(dat,dt.datetime):
>return dat # already in datetime format
>if isinstance(dat,dt.date):
>return dt.datetime.combine(dat,dt.time(0)) # convert to datetime
This is exactly the type checking I would
Michele Simionato wrote:
> Look at this example:
>
> >>> import psycopg
> >>> psycopg.__version__
> '1.1.19'
> >>> import datetime
> >>> today = datetime.datetime.today()
> >>> co = psycopg.connect('')
> >>> cu = co.cursor()
>
> >>> cu.execute('CREATE TABLE example (date date)')
> >>> cu.execute("