hi all,

my problem is i have data like below(dates are in dd\mm\yyyy format)


start_date end_date fruits_eaten per_day_fruit_eaten

5/5/2008 14/5/2008 40 40/10 = 4
12/5/2008 21/5/2008 30 30/10 = 3
20/5/2008 30/5/208 55 55/11 = 5


i want to calculate above data like below

for the dates between 10/5/2008 and 25/5/2008 total fruits eaten are :

10/5/2008 = 4
11/5/2008 = 4
12/5/2008 = 4 + 3
13/5/2008 = 4 + 3
14/5/2008 = 4 + 3
15/5/2008 = 3
16/5/2008 = 3
17/5/2008 = 3
18/5/2008 = 3
19/5/2008 = 3
20/5/2008 = 3 + 5
21/5/2008 = 3 + 5
22/5/2008 = 5
23/5/2008 = 5
24/5/2008 = 5
25/5/2008 = 5


please help me solve this puzzle as it is driving me nuts !! i want to solve it in c# but logics are also welcomed

thanks in advance !

Recommended Answers

All 2 Replies

Your question isnt clear, but there are plenty of functions within the datetime range, have a look..

An array of days perhaps?
For each day in a range, add the average to the totalFruitsPerDay array entry which corresponds to that date.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.