kniterbasdb and datetime
DarkBlue
pict100 at gmail.com
Thu Dec 13 07:35:58 EST 2007
On Dec 13, 7:45 pm, Laszlo Nagy <gand... at shopzeus.com> wrote:
> Hi All,
>
> I connected to a FireBird 1.5 database this way:
>
> import kinterbasdb
> kinterbasdb.init(type_conv=200) # Seehttp://kinterbasdb.sourceforge.net/dist_docs/usage.html#faq_fep_is_mx...
>
> Then I try to update the database:
>
> sql = "UPDATE TABLE1 SET DATEFIELD=? where ID = ?"
> params=[datetime.date(2007,11,01),2341]
> cursor.execute(sql,params)
>
> I get this error:
>
> kinterbasdb.ProgrammingError: (-413, 'isc_dsql_execute: \n conversion
> error from string "2007-11-01"')
>
> What is wrong here?
>
> Thanks,
>
> Laszlo
Kinterbasdb probably expects the format looking like
month/day/year
rather than
year-month-day
I have an old pythoncard app where there was the same issue
when picking a date using the wx.calendar widget,
Rearranging the format solved the problem.
here is the relevant code snippet ,maybe it gives you the idea:
def on_doCalDate_command(self,event):
# this the way to get a wx.calendar date into a
# format suitable for kinterbasdb
D=[]
MYDATE=str(self.components.Calendar1.date)
SPLITDATE=MYDATE.split('-')
for data in SPLITDATE:
D.append(data)
YR=D[0]
MO=D[1]
DY=D[2]
JOBDATE=MO+"/"+DY+"/"+YR
DB
More information about the Python-list
mailing list