Just a thought: Have you tried using "_.str(thedate)" to convert it into a string? I am not using Access, but since Zope can handle the Access date stuff properly, it may be using something like _.str() internally. It's what I would try first. -- Jim Washington "Spicklemire, Jerry" wrote:
Mike said:
I tried what you recommended and got the following error:
Error Type: AttributeError Error Value: __getslice__
The problem I think is that the variable is drawn from the database as type date (Microsoft Access 2k) and somehow is cast into a date type. Is there a way to re-cast this variable as a string type?
You're right, it's not really a string, even though Zope is smart enough to render it into one when inserting it directly into HTML.
I also tried the
<dtml-var "_.string.split(start_date, '/')[1]">
solution but got the error:
Error Type: TypeError Error Value: argument 1: expected read-only character buffer, instance found
Now if only Zope were smart enough to tel us what it "really" is, so we could transform it!
It looks like MS Access delivers dates as some proprietary object type.
However, in your query, you may be able to wrap the date field like so:
to_char(dateFieldName)
to convince MS Access to return a formatted string instead. Once you can see what the string looks like, the slicing bit should work.