Dates, Times, Durations

Brent Pinkney brent.pinkney at aircom.co.za
Mon Jan 24 14:23:49 UTC 2005


On Thu, 20 Jan 2005 13:13:45 -0500, Jason Rogers  
<jacaetevha at fast-mail.org> wrote:

> I would like to calculate the number of work hours between two dates  
> with the basis of a workday being 9:00 to 17:00.

In the 3.8 image:

hours := 0.
('1 January 2005' asDate) to: ('28 May 2005' asDate)
	datesDo: [ :d | (d dayOfWeek between: 2 and: 6) ifTrue: [ hours := hours  
+ 8. ].

note. The Duration above does NOT include 28th May.

I hope this helps.

Brent



More information about the Squeak-dev mailing list