On Tue, 06 Jun 2000, you wrote:
Hey all,
How can I get the current date & time (preferably as a DateTime.DateTime object) in DTML? I cannot instantiate a DateTime object, because the DateTime module is not imported.
Thanks, Ivan Raikov
I saved this answer, because I thought I might need it -- might be what you need: ================================================================== From: "Eric L. Walstad" <ewalstad@energywright.com>To: jeffr@odeon.net Cc: zope@zope.org I think I've got the syntax, Jeff: <dtml-var "_.DateTime(birthday)" fmt=aCommon> - birthday is a field returned from my Z SQL Method - The "_.DateTime(birthday)" part creates a DateTime object - The '_' is a reference to the DTML namespace - The DateTime() function creates the DateTime object - The fmt=aCommon part formats it to look like: "May 7, 1966 12:00 am" You can change the format by changing the fmt=XXXX so that XXXX is the format you want from Appdx A of the Zope DTML reference. Eric. =============================================================== If the you the current time, you might also try using ZopeTime instead of "_.DateTime(birthday)". have fun! Luis.