I found a temporary solution. The goal in the end was to compare two dates/times and retrieve the millisecond delta between the two.
Work around ############# import datetime import time t1 = datetime.datetime(1973,9,4,04,3,25,453) t2 = datetime.datetime(1973,9,4,04,3,25,553) t1tuple = time.mktime(t1.timetuple())+(t1.microsecond/1000.) t2tuple = time.mktime(t2.timetuple())+(t2.microsecond/1000.) delta = (t2tuple - t1tuple) * 1000 print delta On 7/4/06, Tom Tucker <[EMAIL PROTECTED]> wrote: > Below is an example of me converting a datetime to milliseconds on a > Mac running Pythong 2.3.5. The same working code on a Solaris system > with Python 2.3.2 fails. Any thoughts? What arguments am I missing? > > > > From my Mac > ############# > Python 2.3.5 (#1, Oct 5 2005, 11:07:27) > [GCC 3.3 20030304 (Apple Computer, Inc. build 1809)] on darwin > Type "help", "copyright", "credits" or "license" for more information. > >>> import datetime > >>> dtstr = datetime.datetime(1973,9,4,04,3,25,453) > >>> output = dtstr.strftime('%s.%%03d') % (dtstr.microsecond) > >>> print output > 115977805.453 > > > From Work (Solaris) > ################ > Python 2.3.2 (#1, Nov 17 2003, 22:32:28) > [GCC 2.95.3 20010315 (release)] on sunos5 > Type "help", "copyright", "credits" or "license" for more information. > >>> import datetime > >>> dtstr = datetime.datetime(1973,9,4,04,3,25,453) > >>> output = dtstr.strftime('%s.%%03d') % (dtstr.microsecond) > Traceback (most recent call last): > File "<stdin>", line 1, in ? > TypeError: not enough arguments for format string > >>> > _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor