Milliseconds missing in Sybase.datetime

"Bradley Feldman" <[email protected]> Wed, 7 Sep 2005 19:24:36 -0400
Newsgroups gmane.comp.python.sybase
Message-ID <!~!UENERkVCMDkAAQACAAAAAAAAAAAAAAAAABgAAAAAAAAAl26AvnJDdE2pAhSiEiAYTsKAAAAQAAAA65G3w8Bi/[email protected]>
Dave:

I've been working with the Sybase module (latest version) and have run into
a snag in dealing with very precise datetime values.   In my case, I need to
preserve a Full datetime value **including milliseconds** and pass it on to
the database.

I'm using the following code:

sSubmit = str(datetime.datetime.now())
dtSubmit = Sybase.datetime(sSubmit)

This produces a DateTimeType object, but the msecond value is always zero.
It seems to get everything else correctly

It seemed like a silly parsing bug, so I tried a work around, grabbing the
milliseconds myself and trying to set them with:

dtSubmit.msecond = 349499 (whatever)

But this turned into a "TypeError: readonly attribute" exception

So now I'm stuck.  Have you or anyone else got a workaround .... Or a quick
fix?  Is there a non-string way of creating a DateTimeType?  Don't see
anything else in the docs.

Many thanks in advance!
*Bradley