Matty
...the Myth Buster
- Local time
- Today, 01:33
- Joined
- Jun 29, 2001
- Messages
- 396
Hey there,
I have a table full of data, containing date segments for therapy data over several nights for each patient. I'm trying to figure out the total number of days of usage (they could choose not to use the device for a night or two), but doing a simple DateDiff won't work because there could be several segments each night, i.e. from 9pm to 10pm and then from 10:30pm to 11:45pm.
I was going to just count the number of unique dates to get the total number of days, but I hit another problem. A therapy "day" is considered from Noon to Noon, not Midnight to Midnight like a normal day. So a patient who uses the device from 11:20pm on May 1 till 12:30am on May 2 would still be considered one day of usage, not two as I had calculated initially.
So a therapy day would be from 12:00pm on May 1 to 11:59am on May 2. Does anyone have any ideas how I could count therapy days with data like the following:
This example would result in 2 "therapy days" but three "normal days." How could I count the number of "therapy days" from this data?
I have a table full of data, containing date segments for therapy data over several nights for each patient. I'm trying to figure out the total number of days of usage (they could choose not to use the device for a night or two), but doing a simple DateDiff won't work because there could be several segments each night, i.e. from 9pm to 10pm and then from 10:30pm to 11:45pm.
I was going to just count the number of unique dates to get the total number of days, but I hit another problem. A therapy "day" is considered from Noon to Noon, not Midnight to Midnight like a normal day. So a patient who uses the device from 11:20pm on May 1 till 12:30am on May 2 would still be considered one day of usage, not two as I had calculated initially.
So a therapy day would be from 12:00pm on May 1 to 11:59am on May 2. Does anyone have any ideas how I could count therapy days with data like the following:
Code:
[b]ID[/b] [b]Start Time[/b] [b]End Time[/b]
1 May 1 11:20pm May 2 12:30am
1 May 2 12:35am May 2 5:15am
1 May 2 10:30pm May 3 1:00am
1 May 3 1:30am May 3 7:00am
This example would result in 2 "therapy days" but three "normal days." How could I count the number of "therapy days" from this data?