Hi all,
I've done some research into this but can't really find a definitive answer. This questions spans the Table topic and Queries Topic so I'm hoping I can get an answer here.
I have a database where I need to store a time duration. I understand it's not best practice to store duration as a date/time field type. So from this I presume it would be best stored as a number (long integer?). Just to clarify I don't need to store the start or end time, I know I could easily use datediff to get the duration if doing it this way. I just need to store the duration as determined and entered by the user. For example if they enter 7.30, this would be 7 hours 30 minutes. Entering 5.15 would be 5 hours 15 minutes. I also don't want the user to enter the time as a decimal. Main reason for this is that it would be a pain for them to work out the decimal time of every duration they needed to enter.
The next thing I need to understand is the best way to calculate this. I need to sum all of these together to show the total duration spent. The important bit with this calculation is showing it in days where it is based on working hours in a day. For example our working day is 7hours 24 minutes (7.4 as a decimal). So if someone enters 8 hours as one duration, they have spent 1 day 36 mins working on a particular job. This obviously needs to be the same when summing these durations.
Can anyone offer any advice?
I've done some research into this but can't really find a definitive answer. This questions spans the Table topic and Queries Topic so I'm hoping I can get an answer here.
I have a database where I need to store a time duration. I understand it's not best practice to store duration as a date/time field type. So from this I presume it would be best stored as a number (long integer?). Just to clarify I don't need to store the start or end time, I know I could easily use datediff to get the duration if doing it this way. I just need to store the duration as determined and entered by the user. For example if they enter 7.30, this would be 7 hours 30 minutes. Entering 5.15 would be 5 hours 15 minutes. I also don't want the user to enter the time as a decimal. Main reason for this is that it would be a pain for them to work out the decimal time of every duration they needed to enter.
The next thing I need to understand is the best way to calculate this. I need to sum all of these together to show the total duration spent. The important bit with this calculation is showing it in days where it is based on working hours in a day. For example our working day is 7hours 24 minutes (7.4 as a decimal). So if someone enters 8 hours as one duration, they have spent 1 day 36 mins working on a particular job. This obviously needs to be the same when summing these durations.
Can anyone offer any advice?