[Zope] Python DateTime()
Small Business Services
toolkit at magma.ca
Thu May 6 10:38:37 EDT 2004
Cut out the following dtml code and paste it into a method:
<dtml-var standard_html_header>
<h2>Display the date formats and methods available in Zope</h2>
<p>
<dtml-let e="_.DateTime()">
<ul>
<b><i>Formats</i></b><br>
<li> strftime(%Y/%m/%d) --> <dtml-var
expr="e.strftime('%Y/%m/%d')"></li><br>
-------------------------------------------------------------
<li> strftime(%b %d, %Y) --> <dtml-var expr="e.strftime('%b %d, %Y')"></li>
<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>
<b><i>Methods of Date Objects</i></b><br>
<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>
It should give you some ideas of various date/time options (I got it from a
cookbook somewhere, but I can't remember where).
HTH
Jonathan
----- Original Message -----
From: "Andreas Jung" <andreas at andreas-jung.com>
To: "Israel Carr" <icarr at compxnet.com>; <zope at zope.org>
Sent: May 6, 2004 10:18 AM
Subject: Re: [Zope] Python DateTime()
> Methods can only be called on instances not on classes.
>
> -aj
>
> --On Donnerstag, 6. Mai 2004 10:11 Uhr -0400 Israel Carr
> <icarr at compxnet.com> wrote:
>
> > I'm trying to use the following line to insert current date:
> >
> > DateTime.strftime(%m-%d-%Y)
> >
> > ... and get:
> >
> > unbound method strftime() must be called with instance as first argument
> >
> >
> > If I just use:
> >
> > DateTime()
> >
> > ..I get current date, just not the format I want.
> >
> > Ideas?
> >
> > Thanks for your help.
> > Israel
> >
> >
> > _______________________________________________
> > Zope maillist - Zope at 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 )
>
>
>
>
>
> _______________________________________________
> Zope maillist - Zope at 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 )
More information about the Zope
mailing list