mxDateTime for Date Only fields

Jan Murre <[email protected]> Thu, 15 Dec 2016 14:55:16 +0100
Newsgroups gmane.comp.python.egenix.user
Message-ID <CAE_3tvr-Ky=f-2QUdJckdBi3YDmeBYYGpewdAm0hEz2Yf52bsA@mail.gmail.com>
--===============76105516737604884==
Content-Type: multipart/alternative; boundary=001a113d2326a44d040543b2cd55

--001a113d2326a44d040543b2cd55
Content-Type: text/plain; charset=UTF-8

Hi,

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

--001a113d2326a44d040543b2cd55
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div><div><div><div><div><div>Hi,<br><br></div>I am gettin=
g back data from an MS SQL database with Date columns.<br></div>For seriali=
zation I have a generic function to convert date, datetime and mx.DateTime.=
DateTime objects to strings.<br><br></div>When I do a python str() on an mx=
.DateTime.DateTime object, I always get a string with date and time. Althou=
gh, 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 c=
olumns is available, but gets lost in the conversion to mx.DateTime.DateTim=
e.<br><br></div>What I do now is a check on the hour, minute, second attrib=
utes being 0 to decide if this originally was a date-only column.<br><br></=
div>Is a more elegant approach possible?<br><br></div>Regards, Jan<br>=C2=
=A0<br></div>

--001a113d2326a44d040543b2cd55--


--===============76105516737604884==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit


_______________________________________________________________________
eGenix.com User Mailing List                     http://www.egenix.com/
https://www.egenix.com/mailman/listinfo/egenix-users

--===============76105516737604884==--