[Zope-DB] Python/DCOracle Newbie seeking help

Sorisio, Chris ChrisSorisio at PeakTechnical.com
Mon Aug 11 14:08:11 EDT 2003


Hola folks,

I've just started playing with Python and DCOracle2, worked through some of
the examples, pulled out data, etc.  All's been well except for something
that is driving me nuts.

Example code:


--snip--
cdb.execute("select ps_idno, ps_dten, ps_stdt, ps_r1_us, ps_s1_us, ps_r2_us,
nm_ltnm, mcmp.bs_name, mjobo.jc_idch from mnme, mpsn, mcmp, mjobo where
ps_dten > '01-AUG-2003' and mcmp.bs_idno=mpsn.ps_cs_bs and
mjobo.jc_idno=mpsn.ps_jc_jc and mnme.nm_idno=mpsn.ps_cn_nm")

results = cdb.fetchall()

for elements in results:
        exampledate = elements[2]
        
        print exampledate
        print `exampledate`
        testTime = time.strptime(y, "%Y-%m-%d %H:%M:%S")
        time = time.strftime("%d-%b-%Y", testTime)
        print time
--snip--

print exampledate returns a string of the format YYYY-MM-DD HH:MM:SS.
print `exampledate` returns OracleDate("YYYY-MM-DD HH:MM:SS").

Okay, that's fine, all understood, except:

time.strptime complains that y is of type OracleDate and not a string.  How
do I convert it into a string?

Thanks, I'm sure the answer will prompt me to wear a brown bag on my head
for awhile.




More information about the Zope-DB mailing list