Ksenia Marasanova wrote:
> Hi,
>
> I have a class with DateTimeCol "date". I noticed, that the "date"
> property of the instances is sometimes a DateTime object, and
> sometimes a string:
>
> <Newsletter 1 date=<DateTime object for '2004-11-05 04:04:00.00' at
> 212b10> sent=False subject='subject'>
>
> <Newsletter 1 date='2004/11/05 04:04' sent=False subject='subject'>
>
> Is there something I can do to get only DateTime object?
Hmm... I assume that's happening in the driver (MySQLdb, psycopg, etc).
You might try:
def _get_date(self):
date = self._SO_get_date()
if isinstance(date, str):
date = DateTime.convert(date)
return date
I actually don't know the right way to convert the date, you'll have to
look it up in the mxDateTime reference.
--
Ian Bicking / ia...@co... / http://blog.ianbicking.org
|