[Zope] Date Manipulation

Luke Duff luke@geeklife.com
Wed, 3 Mar 1999 07:17:35 -0800


Thanks for the help, but...

My problem is a little bit harder than that. The data in field2 is date *and* 
time. So like this:

field1 field2
------ ---------------
red    3/1/99 10:00 AM
blue   3/1/99 11:00 AM
green  3/1/99 03:00 PM
brown  3/2/99 10:00 AM
yellow 3/2/99 04:30 PM

I've seen in the guide where you can format a data field when outputting, but 
how do actually extract the day-of-the-month number and put it in a temp 
variable. The pseudo-code I've used before to do this before is:

tempday = 0
for each record
  if tempday<>dayofmonth(datefield) then
     print out a header
  print out other fields
  tempday = dayofmonth(datefield)
next

I'm just having a little trouble translating that into DTML. Creating a simple 
temporary variable seems overly complicated.

Luke

============================================================
Martijn Pieters <mj@antraciet.nl> wrote: 

At 05:10 03/03/99 , Luke Duff wrote:
<mj@antraciet.nl>>I'm *really* newbie. I have table with data like this:
<mj@antraciet.nl>>>
<mj@antraciet.nl>>>>field1 field2
<mj@antraciet.nl>>>>>------ ------
<mj@antraciet.nl>>>>>>red    3/1/99
<mj@antraciet.nl>>>>>>>blue   3/1/99
<mj@antraciet.nl>>>>>>>>green  3/1/99
<mj@antraciet.nl>>>>>>>>>brown  3/2/99
<mj@antraciet.nl>>>>>>>>>>yellow 3/2/99
<mj@antraciet.nl>>>>>>>>>>>
<mj@antraciet.nl>>>>>>>>>>>>I'd like to render this in DTML from the data:
<mj@antraciet.nl>>>>>>>>>>>>>
<mj@antraciet.nl>>>>>>>>>>>>>>Monday, March 1
<mj@antraciet.nl>>>>>>>>>>>>>>>  red
<mj@antraciet.nl>>>>>>>>>>>>>>>>  blue
<mj@antraciet.nl>>>>>>>>>>>>>>>>>  green
<mj@antraciet.nl>>>>>>>>>>>>>>>>>>Tuesday, March 2
<mj@antraciet.nl>>>>>>>>>>>>>>>>>>>  brown
<mj@antraciet.nl>>>>>>>>>>>>>>>>>>>>  yellow
<mj@antraciet.nl>>>>>>>>>>>>>>>>>>>>>
<mj@antraciet.nl>>>>>>>>>>>>>>>>>>>>>>How do I do that?
<mj@antraciet.nl>>>>>>>>>>>>>>>>>>>>>>>

You can use the #in tag's grouping features for this. 


------------------------------------------------------------
News, Opinion, Culture for Geeks -- http://www.geeklife.com