[Zope] Date and Time

Jim Fulton jim@digicool.com
Mon, 09 Aug 1999 11:45:16 -0400


Stephan Richter wrote:
> 
> hey guys,
> 
> sorry,
> i have another question:
> How can I display dates and time smart.
> 
> That what I did so far:
> I wrote an external method that returns a DateTime object.
> I call it: <!--#var get_current_time fmt=aCommon-->
> But I want to display everything like I wish using strftime syntax.

You can use strftime formats with date-time objects, as in:

   <!--#var get_current_time fmt="%Y/%m/%d"-->

Note that you can use ZopeTime to get the current time:

   <!--#var ZopeTime fmt="%Y/%m/%d"-->

> I tried to pass a format attribute to the external function, but I could not
> figure out, how to call this function with an attribute.

If the eternal method accepted keywork arguments, you could then use a 
similar syntax:

   <!--#var "get_current_time(fmt=;%Y/%m/%d')"-->


--
Jim Fulton           mailto:jim@digicool.com   Python Powered!        
Technical Director   (888) 344-4332            http://www.python.org  
Digital Creations    http://www.digicool.com   http://www.zope.org    

Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email
address may not be added to any commercial mail list with out my
permission.  Violation of my privacy with advertising or SPAM will
result in a suit for a MINIMUM of $500 damages/incident, $1500 for
repeats.