On Jan 25, 10:55 am, goldtech <[EMAIL PROTECTED]> wrote: > Hi, > > Given an MS-Access table with a date type field with a value of: > 12:00:00 AM - just"12:00:00 AM", there's nothing else in the field. > > I want to print exactly what's in the field, ie. "12:00:00 AM". What I > get printed is: 12/30/0/ 00:00:00 > > I try: [snip] > print oRS.Fields(dt).Value # print here
try this: val = oRS.Fields(dt).Value print type(val) print float(val) If the last one gives you 0.0, then you have got exactly what's in the database -- stored as a fraction of a day. Six AM would give you 0.25. Converting that to 24 hour clock is easy: >>> val = 0.12345 >>> seconds = int(round(val * 60 * 60 * 24)) >>> minutes, second = divmod(seconds, 60) >>> hour, minute = divmod(minutes, 60) >>> '%02d:%02d:%02d' % (hour, minute, second) '02:57:46' >>> ((((46/60.)+57)/60.)+2)/24. # checking 0.12344907407407407 If you don't get 0.0, let us know what you did get. HTH, John -- http://mail.python.org/mailman/listinfo/python-list