I'm passing a date variable to a MySQL database and want to send the date dynamically. In my dtml method file I have <dtml-call "REQUEST.set('now',ZopeTime().ISO())"> which gives me the date in almost the right format - however I need only the 0000-00-00 part at the beginning and don't seem to be able to find a method that returns precisely what I want. I've also tried <dtml-call "REQUEST.set('now',ZopeTime().Date())"> but that doesn't work. Any suggestions? Kate
check the DateTime API -> strftime() in the Zope Book. -aj --On Montag, 15. Dezember 2003 11:45 Uhr -0500 Kate Legere <klegere@kfpl.ca> wrote:
I'm passing a date variable to a MySQL database and want to send the date dynamically.
In my dtml method file I have <dtml-call "REQUEST.set('now',ZopeTime().ISO())">
which gives me the date in almost the right format - however I need only the 0000-00-00 part at the beginning and don't seem to be able to find a method that returns precisely what I want.
I've also tried <dtml-call "REQUEST.set('now',ZopeTime().Date())"> but that doesn't work.
Any suggestions?
Kate
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
<dtml-call "REQUEST.set('now',ZopeTime().strftime('%Y-%m-%d))"> Kate Legere wrote:
I'm passing a date variable to a MySQL database and want to send the date dynamically.
In my dtml method file I have <dtml-call "REQUEST.set('now',ZopeTime().ISO())">
which gives me the date in almost the right format - however I need only the 0000-00-00 part at the beginning and don't seem to be able to find a method that returns precisely what I want.
I've also tried <dtml-call "REQUEST.set('now',ZopeTime().Date())"> but that doesn't work.
Any suggestions?
Kate
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
.
-- God Jul! Merry Christmas! Joyeux Noël! Peter Bengtsson, http://www.peterbe.com
Actually, You should check out http://www.zopelabs.com/cookbook/1071006893 (for TAL) and http://www.zopelabs.com/cookbook/990690237 (for DTML) Brilliant tip. Peter Bengtsson wrote:
<dtml-call "REQUEST.set('now',ZopeTime().strftime('%Y-%m-%d))">
-- God Jul! Merry Christmas! Joyeux Noël! Peter Bengtsson, http://www.peterbe.com
participants (3)
-
Andreas Jung -
Kate Legere -
Peter Bengtsson