waliwali / ibm-db

Automatically exported from code.google.com/p/ibm-db
0 stars 0 forks source link

incorrect date field format #110

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
While retrieving date field from a query, date field output format is not 
correct 

expected format is ISO format (es 2011-01-31) but returned format is EUR (es 
31.01.2011)

to reproduce this issue

import ibm_db 
conn = ibm_db.connect(host, user, password) 
sql = "SELECT datefield FROM mytable" 
stmt = ibm_db.prepare(conn, sql) 
ibm_db.execute(stmt) 
row = ibm_db.fetch_assoc(stmt)
print row
{'datefield': '01.01.2002'}

python 2.7.3
ibm_db win 1.0.5
db2 database server z/os version 9.1.5
db2 database client z/os version 9
os windows 2008 server r2

if we execute the same query through db2 client command line (db2cmd), the 
output is in correct format (2011-01-31)

Thanks
MI

Original issue reported on code.google.com by marcoi...@gmail.com on 9 May 2012 at 2:41

GoogleCodeExporter commented 9 years ago
You are getting the date field in EUR format may due to CLI configuration 
setting.

Please change your CLI setting by issuing following command(without the quotes)
"db2 update cli cfg for section COMMON using DateTimeStringFormat ISO" and you 
can confirm the setting by entering the following (without the quotes): "db2 
get cli cfg".

Please let me know how it works for you.

Original comment by rahul.pr...@in.ibm.com on 14 May 2012 at 9:20

GoogleCodeExporter commented 9 years ago
Thanks for your response.

This solved my issue.

Thanks again
MI

Original comment by marcoi...@gmail.com on 14 May 2012 at 10:24

GoogleCodeExporter commented 9 years ago

Original comment by rahul.pr...@in.ibm.com on 14 May 2012 at 1:39

GoogleCodeExporter commented 9 years ago

Original comment by rahul.pr...@in.ibm.com on 14 May 2012 at 1:40