[Urgent] Timing Allocation Problem

Please support our VB.NET advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Mar 2008
Posts: 27
Reputation: fujilec is an unknown quantity at this point 
Solved Threads: 0
fujilec fujilec is offline Offline
Light Poster

[Urgent] Timing Allocation Problem

 
0
  #1
Jun 22nd, 2008
Lets say i do this to count the number of that particular hour:
  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.
Reply With Quote Quick reply to this message  
Join Date: Dec 2002
Posts: 461
Reputation: waynespangler is on a distinguished road 
Solved Threads: 56
waynespangler waynespangler is offline Offline
Posting Pro in Training

Re: [Urgent] Timing Allocation Problem

 
0
  #2
Jun 23rd, 2008
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.
Wayne

It is hard to understand how a cemetery can raise its burial rates and blame it on the cost of living.
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 60
Reputation: evios is an unknown quantity at this point 
Solved Threads: 0
evios evios is offline Offline
Junior Poster in Training

Re: [Urgent] Timing Allocation Problem

 
0
  #3
Jun 23rd, 2008
Originally Posted by waynespangler View Post
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
Reply With Quote Quick reply to this message  
Join Date: Dec 2002
Posts: 461
Reputation: waynespangler is on a distinguished road 
Solved Threads: 56
waynespangler waynespangler is offline Offline
Posting Pro in Training

Re: [Urgent] Timing Allocation Problem

 
0
  #4
Jun 24th, 2008
Could you show more of your code. I don't know what you are looking for.
Wayne

It is hard to understand how a cemetery can raise its burial rates and blame it on the cost of living.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the VB.NET Forum


Views: 476 | Replies: 3
Thread Tools Search this Thread



Tag cloud for VB.NET
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC