On Thursday 17 May 2001 16:27, Tino Wildenhain wrote:
Hi Gitte,
dont know of the MySQL DA, but if it is so, it is definitively broken. A DateTime entry schould be returned as DateTime object. Anyway, you can use
<dtml-var expr="'ls_'+_.DateTime(ls_startdate).strftime('%Y%m%d%H%M%s')">
in DTML.
(Instead of dtml-var to print out you can assign it to some other object)
HTH Tino Wildenhain
It works !! Thank you :-) I had missed the one with _.DateTime - sorry ... doing that and I can format the string to only display the date or the time .. Regards, Gitte Wange
--On Donnerstag, 17. Mai 2001 16:08 +0200 Gitte Wange <gitte@mmmanager.org>
wrote:
Sorry I don't get this quite, but here's the cold facts :-)
I have a datetime column in a MySQL database which I use for this dtml-doc
The column is called ls_startdate
I need display the startdate in a date field and a time field.
I don't do any manipulation with the ls_startdate other than inserting it into my form.
When I update the database record, I need to create a filename like ls_startdate.rm - But the filename musn't contain any / : or spaces. So I need to strip these away.
But I can't get any of this to work ... please help ..
Gitte
On Thursday 17 May 2001 15:50, Tino Wildenhain wrote:
Hi Gitte,
obviously you have to have DateTime objects to manipulate with them. If you convert them to strings beforehand you are not able to use their methods later :)
If its a DateTime field in your database and not a string field, the result must be a DateTime object with all its methods, including strftime() If not, you have to instantiate a DateTime object from string like this: DateTime(date_time_as_string)
What are you doing with filenames in DTML anyway? If you mean object IDs, you can construct it like this:
<dtml-let objID="_.DateTime(time_as_string).strftime('%Y%m%d')"> <dtml-var objID> </dtml-let>
Omit this DateTime instantiation if you have a real datetime-object from your database as it should be.
Regards Tino Wildenhain
--On Donnerstag, 17. Mai 2001 15:02 +0200 Gitte Wange <gitte@mmmanager.org>
wrote:
On Thursday 17 May 2001 13:00, Tino Wildenhain wrote:
Hi Gitte,
assuming you only want to display the date, you could use the fmt-attribute of the dtml-var tag. <dtml-var YourDate fmt="%Y %m %d"> <dtml-var YourDate fmt="%H:%M:%S">
You can also use:
<dtml-var "YourDate.strftime('%Y %m %d')"> respectively.
Well when I try this, I get this error:
Zope Error
Zope has encountered an error while publishing this resource.
Error Type: AttributeError Error Value: 'string' object has no attribute 'strftime'
I also tried the other solution, but I got an error saying that the Y wasn't a known format type.
Anyone who can help me ?
Regards Gitte Wange
HTH Tino Wildenhain --On Donnerstag, 17. Mai 2001 11:29 +0200 Gitte Wange <gitte@mmmanager.org>
wrote:
Hello,
I have a small problem: In my database I have a datetime field. Now I need to split the content of that field into a date string and a time string with these formats: date: YYYY/MM/DD time: HH:MM:SS
How do I do that?
Another thing: I also need to remove / : and spaces from the datetime string.
How ?
Regards -- ************************ Gitte Wange Jensen
System Squid Developer MMManager Aps +45 29 72 79 72
gitte@mmmanager.org ************************
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )