[Zope] RE: ZopeTime questions (continued)

Samu Mielonen ex@uiah.fi
Fri, 15 Oct 1999 15:53:59 +0300


I wrote:

> 5)
> If I want to make a simple time comparison between release date property
> of an object and current time, how do I do it (e.g. if I only want to
> compare, say that the dates are same - not caring about years, months or
> hours and seconds). If my current object has a property release which
> has been set to ZopeTime at the time of creation:

Actually I found out that isCurrentDay() does what I want.

If I want to check whether object X with a timestamp
property "release" has a value that matches today
(the date, the month, the year, not hours nor minutes),
then I can do:

<dtml-if "release.isCurrentDay()">
   do my thing...
</dtml-if>

and it works. Thanks for the help to Martijn and others.

Now if I could only do the following (here in dtml-pseudo code)...

  <dtml-with #current_year_taken_from_ZopeTime#>
    <dtml-with #current_month_taken_from_ZopeTime#> 
      #do my thing# 
  </dtml-with>
  </dtml-with>

  #current_year_taken_from_ZopeTime# needs to be a number/string, e.g. 1999
  #current_month_taken_from_ZopeTime# needs to be a number/string, e.g. 10
  i.e. I don't want the whole timestamp ZopeTime gives, just year or month

...then I'd be a happy camper :)

The following do not work:

	<dtml-with ZopeTime fmt=year> (fmt is not attribute for with?)

	<dtml-with <dtml-var ZopeTime fmt=year> > (I didn't think so :)

	<dtml-call "REQUEST.set('release', ZopeTime fmt=day)> (invalid syntax)

I'm starting to figure i need to resort to the DateTime()-method instead
of calling the ZopeTime object, but I'm not sure how...
	
Best regards,
   Samu Mielonen

PS I found out an earlier post by Michel Peltier that almost does
what I want (it uses the Catalog to do a search). This list is great
for begginers like me. Thanks again to everyone.