943,733 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 553
  • VB.NET RSS
Jun 22nd, 2008
0

[Urgent] Timing Allocation Problem

Expand Post »
Lets say i do this to count the number of that particular hour:
VB.NET Syntax (Toggle Plain Text)
  1. If vDateTime.Hour > 0 And vDateTime.Hour < 24 Then
  2. Dim hour As Integer = vDateTime.Hour
  3. If hour = 0 Then
  4. hour = 24
  5. End If
  6. 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.
Reputation Points: 10
Solved Threads: 0
Light Poster
fujilec is offline Offline
27 posts
since Mar 2008
Jun 23rd, 2008
0

Re: [Urgent] Timing Allocation Problem

First:
In the 24 hour system you will never have a 24. It only goes to 23:59:59 then 00:00:00.
So you don't need the if statement.
Next:
It looks like your dates are comming in in order. I would make my array hold date and count. Then when new date comes in remove the seconds and minutes and compare it to the last date entered. If they are the same increment the count. Otherwise add the new date to the array.
Reputation Points: 84
Solved Threads: 58
Posting Pro in Training
waynespangler is offline Offline
461 posts
since Dec 2002
Jun 23rd, 2008
0

Re: [Urgent] Timing Allocation Problem

First:
In the 24 hour system you will never have a 24. It only goes to 23:59:59 then 00:00:00.
So you don't need the if statement.
Next:
It looks like your dates are comming in in order. I would make my array hold date and count. Then when new date comes in remove the seconds and minutes and compare it to the last date entered. If they are the same increment the count. Otherwise add the new date to the array.
Ya, U are right. 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
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
evios is offline Offline
60 posts
since Sep 2007
Jun 24th, 2008
0

Re: [Urgent] Timing Allocation Problem

Could you show more of your code. I don't know what you are looking for.
Reputation Points: 84
Solved Threads: 58
Posting Pro in Training
waynespangler is offline Offline
461 posts
since Dec 2002

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: Bowling Bot
Next Thread in VB.NET Forum Timeline: AutoGenerateSelectButton





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC