Tobiah <t...@rcsreg.com> wrote:
>
>I'm grabbing two fields from a MySQLdb connection.
>One is a date type, and one is a time type.
>
>So I put the values in two variables and print them:
>...
>In python 2.3.4, I get:
>
><type 'DateTime'> <type 'DateTimeDelta'>
>2010-07-06 09:20:45.00
>
>Put in python2.4 and greater, I get this:
>
><type 'datetime.date'> <type 'datetime.timedelta'>
>2010-07-06
>
>So I'm having trouble adding the two to get one
>datetime.

Many of the database layers switched to the built-in "datetime" module when
it was introduced in 2.4.  Prior to that, they had to use custom classes.

  date, time = get_fields()
  date = datetime.datetime.fromordinal( date.toordinal() )
  print str(date+time)
-- 
Tim Roberts, t...@probo.com
Providenza & Boekelheide, Inc.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to