...snip... > > I want to print exactly what's in the field, ie. "12:00:00 AM". > Do you understand that this is not really what's present in that field? > What's present in the field is a floating point number. The number > happens to represent the number of days since December 30, 1899. Hours, > minutes, and seconds are stored as the decimal part of the fraction. > One hour is 0.04166666..., for example. > > Access formats it as "12:00:00 AM" for you, because that's the local > time format on your machine, and as Bob said, Access omits the date > portion in the formatting if the number is less than 1.0. That's part > of the Access application, NOT the database engine.
Yes, but I want Python to print what I see when I open Access and look-see. Python is also printing dates w/out times differently too compared to what I see in Access. I was coming from the equivalent Perl code and now trying it in Python. The equivalent Perl code seems to print what I see in Access for Date/Time. eg. it'll print 12:00:00 AM. VS. Python always changes the Date/Time format. For what it's worth here's the Perl code vs Python. Test on Access table with Date/Time Field and you'll see what I'm saying. #!/usr/bin/perl use strict; use warnings; use Win32::OLE(); use Win32::OLE::Variant; $Win32::OLE::Warn=2; my $conn = Win32::OLE->new("ADODB.Connection"); my $db = 'C:\Folder4\datetest1.mdb'; $conn->Open('Provider = Microsoft.Jet.OLEDB.4.0; Data Source='.$db); my $zztop = $conn->Execute("SELECT DATE_FIELD FROM dtest_table"); $zztop->MoveFirst(); while( !$zztop->EOF) { my $ss = $zztop->Fields("DATE_FIELD")->value; print "$ss\n"; $zztop->MoveNext; } VS. import win32com.client from win32com.client import Dispatch oConn=Dispatch('ADODB.Connection') db = r'C:\GIS_Folder4\datetest1.mdb' oConn.Open("Provider=Microsoft.Jet.OLEDB.4.0; data Source="+db) oRS = Dispatch('ADODB.RecordSet') oRS.ActiveConnection = oConn oRS.Open("dtest_table") (oRS, dt) = oConn.Execute('SELECT DATE_FIELD FROM dtest_table') while not oRS.EOF: ss = oRS.Fields(dt).Value print ss oRS.MoveNext() _______________________________________________ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32