I want to retrieve the records from the table in database, and from the TIMESTAMP, to put the counts in their appropriate hourly intervals. It works when say the first occurs AFTER 0730 hr and continues throughout the 24-hour. However, say when the first entry occurs in the midnight at 0430 hr, and continues through 0730 hr, then the counts gets wrong. how should I modify the attached code to cater for different cases?
thanks.
Loading
TAN WhoAMIPosted Aug 13, 2013, 3:02 AM
What I actually want to achieve is this:
1) Get the earliest time count.
2) Go the the next earliest time count, and increment the count..
3) And the loop continues within the 24-hour timeframe.
Iftikar HussainPosted Aug 13, 2013, 2:31 AM
TAN WhoAMIPosted Aug 13, 2013, 2:25 AM
Iftikar HussainPosted Aug 13, 2013, 2:21 AM
TAN WhoAMIPosted Aug 13, 2013, 2:19 AM
I think the issue is to get the earliest time, and use that as the first input...
would you able to join.me?
Iftikar HussainPosted Aug 13, 2013, 1:35 AM
I believe your database column TIMESTAMP has got date also
Regards,
Iftikar
TAN WhoAMIPosted Aug 13, 2013, 1:26 AM
take note the first entry can be anytime.. I attached the sample data here...
Iftikar HussainPosted Aug 13, 2013, 12:58 AM
For eg, if you want to check for today, then your compare date time will be start like this
08/13/2013 07:30
08/13/2013 08:30
08/13/2013 09:30
08/13/2013 10:30
08/13/2013 11:30
and so on
This need to be considered only for getting the count , while displaying you can display without date only
Regards,
Iftikar
TAN WhoAMIPosted Aug 13, 2013, 12:46 AM
Basically the first entry of the count can start anytime within the 24-hour interval. (that 0430 hr is just an example).
when it first starts AFTER 0730 (goes into 0830 slot hour 1) and continues throughout, the count is correct.
but when it starts BEFORE 0730 (goes into 0730 slot hour 24) and continue, the count is wrong...
I think I need to get the first entry correct, that is why I have this:
see attached zip file for the correct and wrong data. It first starts from 0730 (hour 24) and continues up to 0830 (hour 1),and the count is wrong.
maybe I should only have one 0730 (first hour), to avoid confusion, what do you think?
My main purpose here is to retrieve those records from the table in the database, and put them accordingly to its correct time slot, and get its count.
I hope I am clear.
Iftikar HussainPosted Aug 13, 2013, 12:11 AM
You want to get count between 4:30 to 7:30?
Regards,
Iftikar