[Zope] formatting dates
Ashley Lloyd
ashleylloyd@hotmail.com
Tue, 18 Mar 2003 18:40:49 +0000
I'm only a newbie, so someone please correct me if I'm wrong here.
I had the same problem formatting dates retrieved from an Interbase
database, and ended up writing a python script (which I don't have to hand,
sorry), which took in the retrieved date, convert it to a string, split the
string into year, month, day, and then returned a string version of the date
in the format I wanted.
Something like:
myDate=str(aDate)
# Can't remember if the above was necessary, but if in doubt...
year,month,day=myDate.split('/')
dateString=month+'/'+day+'/'+year
return dateString
You then, instead of <dtml-var invc_date fmt="%m/%d/%y">
place <dtml-var "convertDate(invc_date)">
(This can be done better than this, but I am only a newbie, and it is off
the top of my head, and all of my notes are in work!).
HTH
Ashley
_________________________________________________________________
Surf together with new Shared Browsing
http://join.msn.com/?page=features/browse&pgmarket=en-gb&XAPID=74&DI=1059