Hello,

Has any of you ever used Python odbc to retrieve data from a relational DB?

I encountered a problem where it can't handle datetime *earlier than **1969*,
and *later than **2040*. It just returned some garbage strings when I call
str(my_date_object).

When I call strptime to convert the value I got ValueError exception:

# Table records
  for record in self._records:
   columns = []
   for i in range(len(self._description)):
    if self._description[i][1]=='DATE':
     strDate=str(record[i])
     try:
      #convert the date format to be mm/dd/yyyy:
      oDate=time.strptime(strDate) #convert to struct_time object
      strfDate=time.strftime("%m/%d/%Y", oDate)

columns.append(strfDate)
     except ValueError, msg:
      raise "Date converstion error", msg

...
      Any other solutions that you've heard?

Thanks very much in advance,
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to