Oops! Change those "==" to just single "=".
Too much Python on the brain . . .

-----Original Message-----
From: Spicklemire, Jerry 
Sent: Wednesday, July 19, 2000 12:15 PM
To: '[EMAIL PROTECTED]'
Cc: '[EMAIL PROTECTED]'
Subject: Date time format


The DTML User Guide has an "Appendix A" that shows lot's of options, but no
examples. Anyhow, see:

        http://www.zope.org/Documentation/Guides/DTML-HTML/DTML.18.html

You can use these like so:

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

        <dtml-var ZopeTime fmt=="AMPM">

        <dtml-call "REQUEST.set('d_Date',ZopeTime().strftime('%Y/%m/%d'))">
        <dtml-var d_Date>

        <dtml-call "REQUEST.set('d_Date',ZopeTime().strftime('AMPM'))">
        <dtml-var d_Date>

You can also use Python slicing syntax to do something
totally ridiculous like this:

<dtml-call "REQUEST.set('z_t',ZopeTime())">
<dtml-call "REQUEST.set('z_sec',_.int(z_t))">
<dtml-call "REQUEST.set('day_t',_.string.split(_.str(z_t))[1])">
<dtml-call "REQUEST.set('hour_sec',_.int(_.string.split(day_t,':')[0]) *
3600)">
<dtml-call "REQUEST.set('min_sec',_.int(_.string.split(day_t,':')[1]) *60)">
<dtml-call "REQUEST.set('sec_t',_.string.split(day_t,':')[2])">
<dtml-call "REQUEST.set('sec_sec',_.int(_.string.split(sec_t,'.')[0]))">
<dtml-call "REQUEST.set('sum_sec', hour_sec + min_sec + sec_sec - 1)">
<dtml-call "REQUEST.set('start_sec', _.int(z_t) - sum_sec)">
<dtml-call "REQUEST.set('end_sec', start_sec + 86398)">

<dtml-var "_.DateTime(start_sec)" fmt="AMPM"><br>
<dtml-var "_.DateTime(end_sec)" fmt="AMPM"><br>

to find the first and last seconds of a date.

Have a good time!
Jerry S.
        
        
        





_______________________________________________
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )

Reply via email to