Question Timing Allocation Problem

evios

Member
Joined
Jun 3, 2008
Messages
11
Programming Experience
Beginner
Lets say i do this to count the number of that particular hour:
VB.NET:
If vDateTime.Hour > 0 And vDateTime.Hour < 24 Then
                        Dim hour As Integer = vDateTime.Hour
                        If hour = 0 Then
                            hour = 24
                        End If
count(hour, 0) = count(hour, 0) + 1
Refer to the data below:
1.2008/06/24 02:00
2.2008/06/24 12:00
3.2008/06/24 06:00
4.2008/06/24 17:00
5.2008/06/25 06:00
The first will be allocated to hour=02 and the second one will go to hour=12.
However i face this problem: How if 3 and 5 having the same hour but different date? I need to get the date as well. Can i solve this problem using almost the same coding format above? I need to keep count(hour, 0) = count(hour, 0) + 1 this way. Thanks a lot.
 
Now i already simplify my coding to the format below:
I need to allocate the 24-hour time selected by the user to an array of size 24, for example, If the user choose 2day 8AM until tomorrow 7AM, Then my idea is:
hourarray(0)=8AM
hourarray(1)=9AM.....
..hourarray(23)=7AM...
How can i loop it? Thanks
 
Back
Top