[Zope] Getting the day from a Timestamp / gvibda
Oliver Sturm
sturm@oliver-sturm.de
Tue, 22 May 2001 15:47:58 +0200
Hi!
I have a query returning a timestamp column from my interbase 6 database
using the Going Virtual database adapter. I want to extract the values of
the day/month/year ... from the variable. I tried this
<dtml-var date_column fmt="%d">
for the day, but it doesn't work, probably because the variable's type is
not the usual python DateTime. Similarly, this
<dtml-var "_.DateTime(date_column).day()">
doesn't work either. <dtml-var date_column> renders a nice string
representation, so I don't really understand why the above will not work,
but that's certainly my lack of python concept.
Ok, now I found out that date_column is actually of a type called
Timestamp, which is defined in some way in the gvibda sources. That class
has a method tuple,
def tuple(self):
return (self.year, self.month, self.day,
self.hour, self.minute, self.second)
which seems to return everything I need. But how do I call that thing? In
fact, every time I write something like
<dtml-var "date_column.tuple()"> or
<dtml-var "_.date_column.tuple()">
I get some Unauthorized exception for no apparent reason. Wow...
Now, much text, most important question: How can I extract the values I
need from that variable? Can anyone help, please?
Oliver
--
Oliver Sturm / <sturm@oliver-sturm.de>