[Zope] zope:change strings on place

Marcel Preda marcel@punto.it
Tue, 6 Jun 2000 18:34:52 +0200


----- Original Message -----
From: Vincent Maton <vmaton@belgium.aton.net>
Sent: Tuesday, June 06, 2000 5:12 PM

> Can you help me ?
>
> I have some dates in a DataBase but I receive them in string after a query
> and it's in international format, I would like transform it in french
> format.
> With <dtml-var date fmt=%d%m%y>, it doesn't work.
>
> Do you know how can I transform it with strings:
>
> I receive : 2000-04-13
> I want      : 13-04-2000
> or            :  13 april 2000 (this one is better but ???)
>

There's More than One Way to Do It :)


If date is a DateTime object you have to use:

<dtml-var date fmt="%d-%m-%Y">
06-06-2000
or
<dtml-var date fmt="%d-%b-%Y">
06-Jun-2000

or
<dtml-var date fmt="%d-%B-%Y">
06-June-2000
See python doc ,  module "time",function "strftime "


If date is NOT a DateTime object (is a string like '2000-06-06') you have to
use:
<dtml-var "'%s-%s-%s' %(date[8:10],date[5:7],date[0:4])">
06-06-2000


PM