[egenix-users] mxDateTime for Date Only fields

Jan Murre jan.murre at catalyz.nl
Thu Dec 15 14:55:16 CET 2016


I am getting back data from an MS SQL database with Date columns.
For serialization I have a generic function to convert date, datetime and
mx.DateTime.DateTime objects to strings.

When I do a python str() on an mx.DateTime.DateTime object, I always get a
string with date and time. Although, in cursor.description I can see that
the datatype of the column is 91 (which is Manager.TYPE_DATE). So, the
information that this is a date-only columns is available, but gets lost in
the conversion to mx.DateTime.DateTime.

What I do now is a check on the hour, minute, second attributes being 0 to
decide if this originally was a date-only column.

Is a more elegant approach possible?

Regards, Jan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /mailman-archives/egenix-users/attachments/20161215/7b0994dd/attachment.htm

More information about the egenix-users mailing list