[Zope] Getting a date into an object title - DON'T Disregard

Tim Cook tim@freepm.org
Sat, 31 Mar 2001 00:11:13 -0600


complaw@hal-pc.org wrote:
> 
> Therapy or not, I spoke too soon.
> 
> I did manage to get a time in as part of the title.  Unfortunately, the time
> that I got was ZopeTime().
> 
> What I want to get in is the time (really a date) set by the user.  This date is
> taken in as input from the form page, it is then sent to a DTML Method that then
> calls the Python script.  As I mentioned before, the parameter in question is
> "contact_date".
> 
> If I try to set myTitle = '%d' % contact_date then I get an error.

Please Excuse the long post but maybe it will help someone else
too.

Ron,
I didn't find where you said exactly what your error was. I am
guessing it's a type mismatch. You are trying to assign a data to
a string, or you're trying to concatenate a date and string. ??? 

Since you want to sort by the date I would recommend the ISO()
method. 
Below is a little DTML Method that will show you the results of
most of the date formatting in Zope.
HTH,
Tim

------------------------------------------------------------
<dtml-var standard_html_header>
<h2>Display the date formats available in Zope</h2>
<p>
<dtml-let e="_.DateTime()">
<ul>
<li> strftime(%a) --> <dtml-var expr="e.strftime('%a')"></li>
<li> strftime(%A) --> <dtml-var expr="e.strftime('%A')"></li>
<li> strftime(%b) --> <dtml-var expr="e.strftime('%b')"></li>
<li> strftime(%B) --> <dtml-var expr="e.strftime('%B')"></li>
<li> strftime(%c) --> <dtml-var expr="e.strftime('%c')"></li>
<li> strftime(%d) --> <dtml-var expr="e.strftime('%d')"></li>
<li> strftime(%H) --> <dtml-var expr="e.strftime('%H')"></li>
<li> strftime(%I) --> <dtml-var expr="e.strftime('%I')"></li>
<li> strftime(%j) --> <dtml-var expr="e.strftime('%j')"></li>
<li> strftime(%m) --> <dtml-var expr="e.strftime('%m')"></li>
<li> strftime(%M) --> <dtml-var expr="e.strftime('%M')"></li>
<li> strftime(%p) --> <dtml-var expr="e.strftime('%p')"></li>
<li> strftime(%s) --> <dtml-var expr="e.strftime('%s')"></li>
<li> strftime(%U) --> <dtml-var expr="e.strftime('%U')"></li>
<li> strftime(%w) --> <dtml-var expr="e.strftime('%w')"></li>
<li> strftime(%W) --> <dtml-var expr="e.strftime('%W')"></li>
<li> strftime(%x) --> <dtml-var expr="e.strftime('%x')"></li>
<li> strftime(%X) --> <dtml-var expr="e.strftime('%X')"></li>
<li> strftime(%y) --> <dtml-var expr="e.strftime('%y')"></li>
<li> strftime(%Y) --> <dtml-var expr="e.strftime('%Y')"></li>
<li> strftime(%Z) --> <dtml-var expr="e.strftime('%Z')"></li>
</ul>
</p>
<p>
<ul>
<li> dow() --> <dtml-var expr="e.dow()"></li>
<li> aCommon() --> <dtml-var expr="e.aCommon()"></li>
<li> h_12() --> <dtml-var expr="e.h_12()"></li>
<li> HTML4() --> <dtml-var expr="e.HTML4()"></li>
<li> dayOfYear() --> <dtml-var expr="e.dayOfYear()"></li>
<li> AMPM() --> <dtml-var expr="e.AMPM()"></li>
<li> Month() --> <dtml-var expr="e.Month()"></li>
<li> mm() --> <dtml-var expr="e.mm()"></li>
<li> ampm() --> <dtml-var expr="e.ampm()"></li>
<li> hour() --> <dtml-var expr="e.hour()"></li>
<li> aCommonZ() --> <dtml-var expr="e.aCommonZ()"></li>
<li> pCommon() --> <dtml-var expr="e.pCommon()"></li>
<li> minute() --> <dtml-var expr="e.minute()"></li>
<li> day() --> <dtml-var expr="e.day()"></li>
<li> Date() --> <dtml-var expr="e.Date()"></li>
<li> Time() --> <dtml-var expr="e.Time()"></li>
<li> TimeMinutes() --> <dtml-var expr="e.TimeMinutes()"></li>
<li> yy() --> <dtml-var expr="e.yy()"></li>
<li> dd() --> <dtml-var expr="e.dd()"></li>
<li> rfc822() --> <dtml-var expr="e.rfc822()"></li>
<li> fCommon() --> <dtml-var expr="e.fCommon()"></li>
<li> fCommonZ() --> <dtml-var expr="e.fCommonZ()"></li>
<li> timeTime() --> <dtml-var expr="e.timeTime()"> (this is a
floating point number, not a string)</li>
<li> parts() --> <dtml-var expr="e.parts()"> (this is a tuple,
not a string)</li>
<li> PreciseAMPM() --> <dtml-var expr="e.PreciseAMPM()"></li>
<li> AMPMMinutes() --> <dtml-var expr="e.AMPMMinutes()"></li>
<li> pDay() --> <dtml-var expr="e.pDay()"></li>
<li> h_24() --> <dtml-var expr="e.h_24()"></li>
<li> pCommonZ() --> <dtml-var expr="e.pCommonZ()"></li>
<li> dow_1() --> <dtml-var expr="e.dow_1()">(integer)</li>
<li> timezone() --> <dtml-var expr="e.timezone()"></li>
<li> year() --> <dtml-var expr="e.year()"></li>
<li> PreciseTime() --> <dtml-var expr="e.PreciseTime()"></li>
<li> ISO() --> <dtml-var expr="e.ISO()"></li>
<li> millis() --> <dtml-var expr="e.millis()"></li>
<li> second() --> <dtml-var expr="e.second()"></li>
<li> month() --> <dtml-var expr="e.month()">(integer)</li>
<li> pMonth() --> <dtml-var expr="e.pMonth()"></li>
<li> aMonth() --> <dtml-var expr="e.aMonth()"></li>
<li> Day() --> <dtml-var expr="e.Day()"></li>
<li> aDay() --> <dtml-var expr="e.aDay()"></li>
</ul>

</p>

</dtml-let>
<dtml-var standard_html_footer>
--------------------------------------------------------------------
-- 
Tim Cook, President - FreePM,Inc. 
http://www.FreePM.com Office: (901) 884-4126
ONLINE DEMO: http://www.freepm.org:8080/FreePM